Skip to content

Limit GHA to one active build per workflow/branch #2652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2023
Merged

Conversation

pirj
Copy link
Member

@pirj pirj commented Jan 10, 2023

This PR ensures that only the last execution per branch always works, even when pushed multiple times in a row, for example. The older one is canceled.

I find myself pushing often, and with many jobs the GHA limit them to a certain amount of concurrently running jobs.
This limit is applied per-org, so if there's a running rspec-rails build means the rspec-core build jobs will spin in a queued state until the first build jobs start to release job slots.

Refs:

Credit for this feature that went under my radar goes to @ydah

This PR ensures that only the last execution per branch always works,
even when pushed multiple times in a row, for example. The older one is
canceled.

Refs: https://docs.github.com/en/actions/using-jobs/using-concurrency
https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/
@pirj pirj self-assigned this Jan 10, 2023
@pirj pirj requested a review from JonRowe January 10, 2023 21:50
@JonRowe JonRowe merged commit 1357926 into main Jan 10, 2023
@JonRowe JonRowe deleted the ci-use-concurrency branch January 10, 2023 23:29
pirj added a commit that referenced this pull request Jan 11, 2023
Multiple `main` builds were also cancelled.

See rubocop/rubocop#11414 for more context.

Follow-up to #2652
JonRowe pushed a commit that referenced this pull request May 4, 2023
Multiple `main` builds were also cancelled.

See rubocop/rubocop#11414 for more context.

Follow-up to #2652
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants