> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# kelvintaywl/control-flow

Collection of jobs and commands to help manipulate the order of workflows, jobs in your pipeline.


## Jobs

### approve-workflow

Looks for and approve an approval job in a specific workflow in this current pipeline.
Useful for forcing workflow XYZ to run only after workflow ABC.
Assumes the approval job is at the start of workflow XYZ in this case.
See the `sequential-workflow` example for more information.

NOTE: this requires a valid CircleCI API token, and assumes this is available via the $CIRCLE_TOKEN environment variable.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `workflow-name` | string |  | Name of the workflow to look up against.
Assumes the workflow name is unique.
Otherwise, it will look up the first workflow in this pipeline that matches this name.
 |
| `job-name` | string |  | Name of the approval job in workflow to approve.
Assumes the job name is unique.
Otherwise, it will look up the first approval job in the workflow that matches this name.
 |

## Executors

### default

## Examples

### sequential-workflow

Uses control-flow/approve-workflow job, an approval job to control the order between 2 workflows.

In this example, we want to run workflow bbb only after aaa.
We add an approval job (start) as the first job for workflow bbb.
We then add the control-flow/approve-workflow job as the final job in workflow aaa.

Essentially, workflow bbb is on-hold until workflow aaa approves the approval job in workflow bbb.


```yaml
version: '2.1'
orbs:
  flow: kelvintaywl/control-flow@0.1
jobs:
  noop:
    docker:
      - image: cimg/base:current
    resource_class: small
    steps:
      - run: echo "noop"
workflows:
  aaa:
    jobs:
      - noop:
          name: build
      - flow/approve-workflow:
          workflow-name: bbb
          job-name: start
          requires:
            - build
          context:
            - circleci-api
  bbb:
    jobs:
      - start:
          type: approval
      - noop:
          name: deploy
          requires:
            - start
```