How to use an orb

I am new to circleci so not sure how to use to use an orb in our existing build config. The orb in question is CircleCI Developer Hub - ganezasan/auto-cancel-workflow

Is tehre any example on how to use orbs?

HI @ryeparrotsavannahrye,

Welcome to the CircleCI community forum!

We have comprehensive documentation on how to use an Orb here. For this particular orb, please use the below config as reference:

version: 2.1
orbs:
  auto-cancel-workflow: ganezasan/auto-cancel-workflow@0.0.6
workflows:
  version: 2
  auto-cancel-example:
    jobs:
      - job-1
      - job-2
      - job-2
      - auto-cancel-workflow/auto-cancel

I will also ask the author of the orb if he can include some examples on how to use it in the orb page directly.

Regards,
Pawan Bahuguna

1 Like

Thanks. Quick question regarding CIRCLECI_TOKEN. The existing config that i am using already has context (which has this token in it). This context is part of the job. Can I use the context for this orb as well? If so how?

Yes, you can use the same context.

version: 2.1
orbs:
  auto-cancel-workflow: ganezasan/auto-cancel-workflow@0.0.6
workflows:
  version: 2
  auto-cancel-example:
    jobs:
      - job-1
      - job-2
      - job-2
      - auto-cancel-workflow/auto-cancel:
          context:
             - mycontext

More info on contexts: Using Contexts - CircleCI

1 Like