-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add concurrency groups to cancel superseded PR runs #54
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,29 +1,33 @@ | ||||||||||||||
| name: Monorepo CI | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| workflow_dispatch: | ||||||||||||||
| push: | ||||||||||||||
| branches: [master] | ||||||||||||||
| paths: | ||||||||||||||
| - "engine/**" | ||||||||||||||
| - "desktop/**" | ||||||||||||||
| - "website/**" | ||||||||||||||
| - "orchestration/**" | ||||||||||||||
| - "vscode-extension/**" | ||||||||||||||
| - ".github/workflows/monorepo-ci.yml" | ||||||||||||||
| pull_request: | ||||||||||||||
| branches: [master] | ||||||||||||||
| paths: | ||||||||||||||
| - "engine/**" | ||||||||||||||
| - "desktop/**" | ||||||||||||||
| - "website/**" | ||||||||||||||
| - "orchestration/**" | ||||||||||||||
| - "vscode-extension/**" | ||||||||||||||
| - ".github/workflows/monorepo-ci.yml" | ||||||||||||||
|
|
||||||||||||||
| concurrency: | ||||||||||||||
| group: monorepo-ci-${{ github.event.pull_request.number || github.ref }} | ||||||||||||||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||||||||||||||
|
Comment on lines
+24
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Fix the concurrency block indentation. The YAML validator flags Line 25 because the child keys use four spaces. Reindent the block to the expected two-space level. Proposed fix concurrency:
- group: monorepo-ci-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+ group: monorepo-ci-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: Validate YAML Files[failure] 25-25: 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| changes: | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| outputs: | ||||||||||||||
| engine: ${{ steps.filter.outputs.engine }} | ||||||||||||||
| desktop: ${{ steps.filter.outputs.desktop }} | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ on: | |
| issue_comment: | ||
| types: [created] | ||
|
|
||
| concurrency: | ||
| group: pr-comment-handler-${{ github.event.issue.number }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When three comments arrive on the same PR while the first handler is still running, the second run becomes pending and the third replaces it, so the second comment is never analyzed or applied. Omitting Useful? React with 👍 / 👎.
Comment on lines
+7
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
for f in \
.github/workflows/pr-comment-handler.yml \
.github/workflows/copilot-setup-steps.yml \
.github/workflows/destroy-infra.yml \
.github/workflows/release-desktop.yml
do
printf '\n===== %s =====\n' "$f"
sed -n '1,45p' "$f"
done
printf '\n===== concurrency and queue keys =====\n'
rg -n -C 3 'concurrency:|cancel-in-progress|queue:' .github/workflowsRepository: phoenixvc/codeflow-engine Length of output: 12590 🌐 Web query:
💡 Result: In GitHub Actions, the Citations:
🏁 Script executed: #!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re
files = [
".github/workflows/pr-comment-handler.yml",
".github/workflows/copilot-setup-steps.yml",
".github/workflows/destroy-infra.yml",
".github/workflows/release-desktop.yml",
]
for name in files:
text = Path(name).read_text(encoding="utf-8-sig")
concurrency = text.split("concurrency:", 1)[1].split("\njobs:", 1)[0]
group = re.search(r"group:\s*(.+)", concurrency)
cancel = re.search(r"cancel-in-progress:\s*(.+)", concurrency)
queue = re.search(r"queue:\s*(.+)", concurrency)
print(name)
print(" group:", group.group(1).strip() if group else "<missing>")
print(" cancel-in-progress:", cancel.group(1).strip() if cancel else "<omitted>")
print(" queue:", queue.group(1).strip() if queue else "<omitted>")
print(" trigger:", text.split("on:", 1)[1].split("concurrency:", 1)[0].strip().replace("\n", " "))
PY
printf '\n===== official documentation references =====\n'
curl -L --fail --silent --show-error \
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax \
| rg -n -i -C 3 'queue: max|pending|concurrency group|cancel-in-progress' | head -120Repository: phoenixvc/codeflow-engine Length of output: 20500 🌐 Web query:
💡 Result: In GitHub Actions, the Citations:
Preserve required pending runs with
📍 Affects 4 files
🤖 Prompt for AI Agents |
||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
|
|
||
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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: phoenixvc/codeflow-engine
Length of output: 6353
🌐 Web query:
site:docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions concurrency one running one pending queued job new queued cancels pending💡 Result:
In the context of GitHub Actions, the behavior you described is the default configuration for concurrency groups [1]. When a concurrency group has a job already running and a new job is triggered, the new job enters a pending state [1]. By default, if another job is already in the pending state within that same group, that existing pending job is canceled and replaced by the new incoming job [1]. This default behavior is defined by the queue property being set to single, which ensures at most one job or workflow run can be pending in the concurrency group at any time [1]. To change this behavior to allow more jobs to queue instead of being canceled, you can set the queue property to max, which allows up to 100 jobs to wait in the queue before additional jobs are canceled [1]. Additionally, you can control whether the currently running job is canceled by setting the cancel-in-progress property to true [1].
Citations:
🏁 Script executed:
Repository: phoenixvc/codeflow-engine
Length of output: 2449
🌐 Web query:
GitHub Actions concurrency queue key queue: max official documentation💡 Result:
In GitHub Actions, the
queue: maxproperty within theconcurrencyconfiguration allows up to 100 jobs or workflow runs to be placed in a pending state per concurrency group [1][2]. Key details regardingqueue: max: - Functionality: By default, only one run can be in apendingstate for a concurrency group, with new runs canceling the previous one [1][3]. Settingqueue: maxenables a queue of up to 100 pending runs that execute sequentially [1][4]. - Queue Limit: Once the queue reaches the limit of 100 pending runs, any additional jobs or workflow runs added to that concurrency group will be canceled [1][2]. - Restriction: You cannot usequeue: maxin combination withcancel-in-progress: true[1][3]. Attempting to do so will result in a workflow validation error because they represent conflicting behaviors for handling in-progress runs [1][4]. Example configuration: concurrency: group: production-deploy queue: max [1][3]Citations:
🏁 Script executed:
Repository: phoenixvc/codeflow-engine
Length of output: 2449
Serialize all production destroys and preserve pending requests.
destroy-infra-production;github.refallows destroys from different refs to run concurrently.queue: max; otherwise, a new pending run replaces the existing pending run in the same group.🤖 Prompt for AI Agents