cancel-workflow-action icon indicating copy to clipboard operation
cancel-workflow-action copied to clipboard

Documentation: Compare with native `concurrency` key

Open ocean90 opened this issue 4 years ago • 5 comments

GitHub has announced that workflows "now support a concurrency key at both the workflow and job level that will ensure that only a single run or job is in progress". The syntax documentation has already been updated:

# Example using concurrency to cancel any in-progress job or run
concurrency: 
  group: ${{ github.head_ref }}
  cancel-in-progress: true

I'm wondering if it would be helpful to document in the readme what the differences are and which implementation might be more useful depending on use cases. I think this will be helpful for anyone currently using this action and thinking about switching but even for new users. Any thoughts?

ocean90 avatar Apr 21 '21 07:04 ocean90

That looks really cool - appears to be nice for cases where you want to cancel previous of same workflow - plus obviously for things where you are interested in making sure multiple jobs don't run in parallel

But it does not handle other-workflow cancel or the new (super useful) all_but_latest feature here

mikehardy avatar Apr 21 '21 19:04 mikehardy

Very cool! Looks like its still in beta and subject to change though.

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency

styfle avatar Apr 22 '21 20:04 styfle

Yep, it also seems to not work as expected right now:

  • https://github.community/t/concurrency-cancel-in-progress-at-top-level-doesnt-seem-to-cancel-running-workflows/175801/6
  • https://github.community/t/actions-concurrency-bug-report/175695

ocean90 avatar Apr 23 '21 13:04 ocean90

Trying to implement the concurrency at the job level in a multi-job workflow and getting a properties error.

.github/workflows/deploy-gluon-api.yml failed test
[
  {
    instancePath: '/jobs/deploy-dev-canary',
    schemaPath: '#/properties/jobs/patternProperties/%5E%5B_a-zA-Z%5D%5Ba-zA-Z0-9_-%5D*%24/additionalProperties',
    keyword: 'additionalProperties',
    params: { additionalProperty: 'concurrency' },
    message: 'must NOT have additional properties'
  }
]

implementation in workflow for context:

jobs:
  job1:
  ...

  deploy-dev-canary:
    concurrency:
      group: ${{ github.ref }}
      cancel-in-progress: true
    environment:
      name: "appname-dev-canary"
    needs: setup
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      ...

What is wrong with my implementation at the job level?

abetterbuilder avatar Jun 23 '21 21:06 abetterbuilder

Also mentioned here https://github.com/styfle/cancel-workflow-action/issues/133#issuecomment-1040039549

styfle avatar Feb 15 '22 21:02 styfle