Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
According to GitHub Actions documentation, when a pull request is merged into a branch, can bothpushon the target branch andpull_request_targetwithtypes: [closed]trigger for the same merge, and how doesconcurrency.cancel-in-progress: falsebehave for two runs in the same static concurrency group?💡 Result:
Yes—both can trigger for the same merge. When a pull request is merged, the PR’s
pull_request(orpull_request_target) event withtypes: [closed]will fire, and the merge also creates apushevent on the branch the PR was merged into (the target branch). GitHub’s events documentation explains that to run when a PR merges you use thepull_requestclosedtype with a condition onmerged == true(the same applies topull_request_target’s correspondingclosedtype), and it also documents the separatepushevent trigger for workflows on branch updates.[1][2] Aboutconcurrency.cancel-in-progress: falsefor two runs in the same static concurrency group: only one run can be “running” at a time within a concurrency group, and when a new run is queued while another is in progress, the queued run becomespending; any previously pending run in the same group is canceled and replaced by the newest queued run. Settingcancel-in-progress: falseprevents canceling the currently running run, but it does not prevent cancellation of the pending/queued run(s) when newer runs arrive (with the defaultqueue: single, there is at most one pending run at a time).[3][4] So, with two near-simultaneous events that both create workflow runs in the same concurrency group: 1) The first run starts (in-progress). 2) The second run is queued as pending. 3) If additional runs arrive before the first completes, earlier pending runs are canceled/replaced—but the first in-progress run is not canceled becausecancel-in-progress: false.[3][4] If you need, share the exact YAML (including yourconcurrency.groupexpression and whether you setqueue:), and I can map it precisely to your scenario.Citations:
Dedup deploy triggers—concurrency serializes runs but won’t prevent duplicate redeploys
deploy-dev.ymlcan enqueue two workflow runs for the same merge (pushtodevandpull_request_targetclosed). Withconcurrency.group: deploy-dev, those runs won’t execute concurrently (only one in-progress run per group); however,cancel-in-progress: falsestill lets the queued run(s) execute afterward, causing the dev environment to be redeployed multiple times sequentially. Consider deduping at the trigger/condition level (or include a per-merge key like the merged commit SHA inconcurrency.groupif you only want one deploy per merge).🤖 Prompt for AI Agents