Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 11

How to limit concurrent workflow runs

Hello,

 

I have a workflow that deploys my project on push to master. When I push several changes in rapid succession, this causes multiple simultaneous deployments to happen. This happens a lot when rapidly merging automated PRs, such as dependabot PRs -- when I merge 6 dependabot PRs, I need to deploy only once; not 6 times. I need to restrict the number of concurrent workflow runs to 1 so that only a single deployment runs at a time, or a way to queue workflows to run after some "debounce" period. What options do I have?

 

Thanks!

Bryan

10 Replies
GitHub Partner
Message 2 of 11

Re: How to limit concurrent workflow runs

Hi,

 

Currently it's NOT supported to limit the number of workflow runs if you merge multi PRs into same branch with pull request trigger.

Copilot Lvl 2
Message 3 of 11

Re: How to limit concurrent workflow runs

Thanks for the reply. Is anything like this planned? This is wasting a lot of build minutes for me both in GH Actions and with my hosting provider, who charges me for build minutes used during deployments.

Copilot Lvl 2
Message 4 of 11

Re: How to limit concurrent workflow runs

I'm also curious about this feature. Configurating concurrency for each workflow programatically or could I defer to run jobs till previous workflow done? Or github have plan for this?

Copilot Lvl 2
Message 5 of 11

Re: How to limit concurrent workflow runs

I would like this feature too. There are already hard limits on concurrency so it'd be nice to see those limit controls made available to users so we can lower them even further.

 

https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-...

 

There are workarounds for this, but ideally this is something the automation pipeline should handle without the risk of introducing potential race conditions and manual coordination.

Copilot Lvl 2
Message 6 of 11

Re: How to limit concurrent workflow runs

Adding another use case: race conditions in deploy workflows

Assume I have a CD system that runs deploys on merges to master.

Two people merge quickly, the two actions will race and I won't know which one will win.

 

The ability to limit concurrency (even if just to 1) would be great.

 

@jahed what workarounds did you have in mind?

Copilot Lvl 2
Message 7 of 11

Re: How to limit concurrent workflow runs

Use a custom queue somewhere. Have workflows check the queue before executing. If there's a running workflow, add to the queue and exit early. Workflows can either trigger the next run before exiting or something else can coordinate workflow runs.

Not saying it's perfect but good enough until the feature is implemented.
GitHub Partner
Message 8 of 11

Re: How to limit concurrent workflow runs

Thanks all for your feedback!

I have submitted a query about limiting workflow runs number internally, will update if there's a response.

GitHub Partner
Message 9 of 11

Re: How to limit concurrent workflow runs

Thanks all for your feedback!

Responsed from github:

This is something we'll work on but we don't have any timeline we can share yet.

Copilot Lvl 2
Message 10 of 11

Re: How to limit concurrent workflow runs

any news on this? I too would like something like this