Skip to content

[Feature]: Using concurrency option in CI to limit number of runners spun up per branch #2335

@pitoniak32

Description

@pitoniak32

Related Problems?

If a branch has multiple pushes that happen before a previous CI run has time to finish it will start up a whole new set of jobs for the new push while the previous set of jobs keep running in the background. The previous set are stale since there was a new push that has changes, so the previous run should get cancelled to avoid wasting runner resources

Describe the solution you'd like:

There is an option for workflows to set a concurrency field group that will be unique to a branch / workflow combo, and it will cancel previous in progress / queued runs if there is a new push

essentially if the following is added to the workflows for CI it will avoid running multiple workflows at the same time when we only care about the latest run result

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

See more details here:
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs#example-using-concurrency-and-the-default-behavior

Considered Alternatives

No response

Additional Context

We use this at work to avoid consuming too many runner resources at a time

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions