When GitLab Pipeline passes → move to state

You will need to add a web hook to your GitLab repository. Please check this article to learn how to do that.

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'