When GitLab Pipeline passes → move to state

10091009

JavaScript for action:

const branch = args.body.object_attributes.ref;
// Branch is smth like `us12345`
const match = branch.match(/^us(\d+)/);
if (match && isFinite(match[1])) {
  const entityId = parseInt(match[1]);

  return {
    command: 'targetprocess:MoveToState',
    payload: {
      resourceType: 'UserStory',
      resourceId: entityId,
      stateKind: 'Final'
    }
  }
}