Skip to content

ci: add concurrency groups to top-level workflows - #2333

Merged
zackees merged 1 commit into
masterfrom
ci/workflow-concurrency-groups
Apr 18, 2026
Merged

zackees merged 1 commit into
masterfrom
ci/workflow-concurrency-groups

Conversation

@zackees

@zackees zackees commented Apr 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds a concurrency block to 85 top-level workflow YAMLs so new PR pushes cancel their own previous in-progress runs.
  • Uses cancel-in-progress: ${{ github.event_name == 'pull_request' }}, so master-branch pushes are still each validated end-to-end.
  • Skips the 11 reusable templates (they inherit the caller's concurrency), the Claude/project-automation/drift-sync/lint coordination workflows, and the docker_compiler_*.yml image builds where mid-build cancellation would leave partial registry state.

Motivation

A single feature branch fanning out ~100 parallel jobs was starving the GitHub-hosted runner pool — at the time this PR was opened the repo had ~1785 queued runs vs ~75 in_progress, with a 4-hour-old master push sitting in the queue unassigned. Canceling redundant per-branch PR runs is the standard fix for this.

Test plan

  • PR itself runs and passes with the new concurrency behavior.
  • Push a second commit to this branch and verify the previous run is automatically cancelled.
  • Confirm master pushes after merge still run to completion (not auto-cancelled).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved CI/CD pipeline efficiency by implementing concurrency controls across automated workflows. Pull requests now automatically cancel previous in-progress runs for the same branch, reducing resource consumption and providing faster feedback on updates.

Cancel redundant in-progress runs on PR pushes so a rapid-fire feature
branch with ~100 parallel jobs cannot monopolize runner capacity. Master
pushes keep cancel-in-progress=false so every commit on the main branch
is still fully validated.

Applied to 85 top-level caller workflows. Skipped: 11 reusable templates
(they inherit the caller's concurrency), claude.yml, project_*.yml,
arduino_library_lint.yml, and the docker_compiler_*.yml image builds
(cancelling mid-build would leave partial registry state).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Added concurrency configuration to 77 GitHub Actions workflow files across the project. Each workflow now groups runs by workflow name and git ref, automatically canceling in-progress runs when triggered by pull requests. No job definitions, triggers, or build logic were modified.

Changes

Cohort / File(s) Summary
Workflow Concurrency Configuration
.github/workflows/avr8js_uno_test.yml, build.yml, build_adafruit_feather_nrf52840_sense.yml, build_adafruit_xiaoblesense.yml, build_apollo3_red.yml, build_apollo3_thing_explorable.yml, build_atmega8a.yml, build_attiny1604.yml, build_attiny1616.yml, build_attiny4313.yml, build_attiny85.yml, build_attiny88.yml, build_blackpill_stm32f4.yml, build_bluepill.yml, build_clone_and_compile.yml, build_digix.yml, build_due.yml, build_esp32_i2s_ws2812.yml, build_esp32c2.yml, build_esp32c3.yml, build_esp32c5.yml, build_esp32c6.yml, build_esp32dev.yml, build_esp32dev_idf3.3.yml, build_esp32dev_idf4.4.yml, build_esp32dev_namespace.yml, build_esp32h2.yml, build_esp32p4.yml, build_esp32s2.yml, build_esp32s3.yml, build_esp32wroom.yml, build_esp8266.yml, build_esp_extra_libs.yml, build_giga_r1.yml, build_linux.yml, build_maple_map.yml, build_mgm240s_thingplusmatter.yml, build_nano_every.yml, build_nrf52840_dk.yml, build_nrf52_xiaoblesense.yml, build_nucleo_f429zi.yml, build_nucleo_f439zi.yml, build_rgbw.yml, build_rp2040.yml, build_rp2350.yml, build_rp2350B.yml, build_stm103tb.yml, build_teensy30.yml, build_teensy31.yml, build_teensy32.yml, build_teensy35.yml, build_teensy36.yml, build_teensy40.yml, build_teensy41.yml, build_teensy41_ofled.yml, build_teensyLC.yml, build_teensy_octo.yml, build_uno.yml, build_uno_r4_wifif.yml, build_wasm.yml, build_wasm_compilers.yml, build_yun.yml, check_attiny85.yml, check_bluepill_size.yml, check_esp32_size.yml, check_teensy30_size.yml, check_teensy31_size.yml, check_teensy32_size.yml, check_teensy35_size.yml, check_teensy36_size.yml, check_teensy41_size.yml, check_teensylc_size.yml, check_uno_size.yml, docs2.yml, example_test_linux.yml, example_test_macos.yml, example_test_windows.yml, header-perf.yml, iwyu.yml, qemu_esp32c3_test.yml, qemu_esp32dev_test.yml, qemu_esp32s3_test.yml, unit_test_linux.yml, unit_test_macos.yml, unit_test_windows.yml
Added concurrency block to each workflow with group: ${{ github.workflow }}-${{ github.ref }} and cancel-in-progress: ${{ github.event_name == 'pull_request' }}, ensuring runs are grouped by workflow and ref while automatically canceling in-progress runs only for pull request events.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Seventy-seven workflows now sing in perfect time,
Each one grouped by ref and workflow in rhyme,
Pull requests won't clash, they'll cancel with grace,
GitHub Actions running smooth across the codebase! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding concurrency groups to top-level CI workflows. It accurately reflects the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/workflow-concurrency-groups

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/avr8js_uno_test.yml:
- Around line 3-5: Change the concurrency group to use github.run_id for non-PR
events and keep PRs deduplicated by ref: replace the current group expression
with one that evaluates to "${{ github.workflow }}-${{ github.event_name ==
'pull_request' && github.ref || github.run_id }}" and update cancel-in-progress
to be conditional (set to "${{ github.event_name == 'pull_request' }}" so only
PR runs cancel in-progress runs). This touches the concurrency `group` and
`cancel-in-progress` entries in the workflow.

In @.github/workflows/build_esp32c2.yml:
- Around line 3-5: The concurrency group currently uses a shared key that
collapses multiple master pushes; update the concurrency.group expression to use
github.ref for pull_request events but github.sha for push events (e.g. change
concurrency.group to something like ${{ github.workflow }}-${{ github.event_name
== 'pull_request' && github.ref || github.sha }}), and leave
concurrency.cancel-in-progress behaviour as-is (cancel-in-progress: ${{
github.event_name == 'pull_request' }}) so PRs still cancel pending runs while
pushes get unique queue keys.

In @.github/workflows/build_teensy41_ofled.yml:
- Around line 3-5: Change the concurrency group so non-PR runs use a unique
group (preventing queued push/master validations from canceling each other):
replace the current group expression (group: ${{ github.workflow }}-${{
github.ref }}) with a conditional that keeps the existing stable group for PRs
but appends a unique run identifier for non-PR events (use the existing
cancel-in-progress expression github.event_name == 'pull_request' and append
github.run_id for non-PRs), updating the concurrency.group line that references
${{ github.workflow }} and ${{ github.ref }} to include ${{ github.run_id }}
when github.event_name != 'pull_request'.

In @.github/workflows/build.yml:
- Around line 3-5: The concurrency block is ineffective because
cancel-in-progress: ${{ github.event_name == 'pull_request' }} will always be
false in this push-only workflow; either remove the entire concurrency block
(remove the concurrency: group/cancel-in-progress keys) if you don't want
serializing pushes, or change cancel-in-progress to a push-appropriate
expression (e.g. true to cancel previous runs for the same group) and/or adjust
group (currently using group: ${{ github.workflow }}-${{ github.ref }}) to
produce the desired uniqueness; update the concurrency keys (concurrency, group,
cancel-in-progress) accordingly.

In @.github/workflows/header-perf.yml:
- Around line 3-5: Current concurrency grouping groups all non-PR pushes by
branch which causes pending master/main pushes to be replaced; update the
concurrency.group expression so PR runs remain grouped by workflow+ref but
non-PR runs include a unique identifier (e.g., github.run_id) so each push
validation is its own group; implement this by changing the group expression
that currently uses github.workflow and github.ref (and checks
github.event_name) to conditionally append github.run_id when github.event_name
!= 'pull_request' while leaving PR behavior unchanged, and keep the existing
cancel-in-progress handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bc6458a3-76a1-4cfc-88b0-5522fa3b6daf

📥 Commits

Reviewing files that changed from the base of the PR and between 2230aa4 and 4988f7e.

📒 Files selected for processing (85)
  • .github/workflows/avr8js_uno_test.yml
  • .github/workflows/build.yml
  • .github/workflows/build_adafruit_feather_nrf52840_sense.yml
  • .github/workflows/build_adafruit_xiaoblesense.yml
  • .github/workflows/build_apollo3_red.yml
  • .github/workflows/build_apollo3_thing_explorable.yml
  • .github/workflows/build_atmega8a.yml
  • .github/workflows/build_attiny1604.yml
  • .github/workflows/build_attiny1616.yml
  • .github/workflows/build_attiny4313.yml
  • .github/workflows/build_attiny85.yml
  • .github/workflows/build_attiny88.yml
  • .github/workflows/build_blackpill_stm32f4.yml
  • .github/workflows/build_bluepill.yml
  • .github/workflows/build_clone_and_compile.yml
  • .github/workflows/build_digix.yml
  • .github/workflows/build_due.yml
  • .github/workflows/build_esp32_i2s_ws2812.yml
  • .github/workflows/build_esp32c2.yml
  • .github/workflows/build_esp32c3.yml
  • .github/workflows/build_esp32c5.yml
  • .github/workflows/build_esp32c6.yml
  • .github/workflows/build_esp32dev.yml
  • .github/workflows/build_esp32dev_idf3.3.yml
  • .github/workflows/build_esp32dev_idf4.4.yml
  • .github/workflows/build_esp32dev_namespace.yml
  • .github/workflows/build_esp32h2.yml
  • .github/workflows/build_esp32p4.yml
  • .github/workflows/build_esp32s2.yml
  • .github/workflows/build_esp32s3.yml
  • .github/workflows/build_esp32wroom.yml
  • .github/workflows/build_esp8266.yml
  • .github/workflows/build_esp_extra_libs.yml
  • .github/workflows/build_giga_r1.yml
  • .github/workflows/build_linux.yml
  • .github/workflows/build_maple_map.yml
  • .github/workflows/build_mgm240s_thingplusmatter.yml
  • .github/workflows/build_nano_every.yml
  • .github/workflows/build_nrf52840_dk.yml
  • .github/workflows/build_nrf52_xiaoblesense.yml
  • .github/workflows/build_nucleo_f429zi.yml
  • .github/workflows/build_nucleo_f439zi.yml
  • .github/workflows/build_rgbw.yml
  • .github/workflows/build_rp2040.yml
  • .github/workflows/build_rp2350.yml
  • .github/workflows/build_rp2350B.yml
  • .github/workflows/build_stm103tb.yml
  • .github/workflows/build_teensy30.yml
  • .github/workflows/build_teensy31.yml
  • .github/workflows/build_teensy32.yml
  • .github/workflows/build_teensy35.yml
  • .github/workflows/build_teensy36.yml
  • .github/workflows/build_teensy40.yml
  • .github/workflows/build_teensy41.yml
  • .github/workflows/build_teensy41_ofled.yml
  • .github/workflows/build_teensyLC.yml
  • .github/workflows/build_teensy_octo.yml
  • .github/workflows/build_uno.yml
  • .github/workflows/build_uno_r4_wifif.yml
  • .github/workflows/build_wasm.yml
  • .github/workflows/build_wasm_compilers.yml
  • .github/workflows/build_yun.yml
  • .github/workflows/check_attiny85.yml
  • .github/workflows/check_bluepill_size.yml
  • .github/workflows/check_esp32_size.yml
  • .github/workflows/check_teensy30_size.yml
  • .github/workflows/check_teensy31_size.yml
  • .github/workflows/check_teensy32_size.yml
  • .github/workflows/check_teensy35_size.yml
  • .github/workflows/check_teensy36_size.yml
  • .github/workflows/check_teensy41_size.yml
  • .github/workflows/check_teensylc_size.yml
  • .github/workflows/check_uno_size.yml
  • .github/workflows/docs2.yml
  • .github/workflows/example_test_linux.yml
  • .github/workflows/example_test_macos.yml
  • .github/workflows/example_test_windows.yml
  • .github/workflows/header-perf.yml
  • .github/workflows/iwyu.yml
  • .github/workflows/qemu_esp32c3_test.yml
  • .github/workflows/qemu_esp32dev_test.yml
  • .github/workflows/qemu_esp32s3_test.yml
  • .github/workflows/unit_test_linux.yml
  • .github/workflows/unit_test_macos.yml
  • .github/workflows/unit_test_windows.yml

Comment on lines +3 to +5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Lists workflows using the shared github.ref concurrency group while also having non-PR triggers.
python - <<'PY'
from pathlib import Path

for p in sorted(Path(".github/workflows").glob("*.y*ml")):
    s = p.read_text()
    if "group: ${{ github.workflow }}-${{ github.ref }}" not in s:
        continue

    non_pr_events = []
    for event in ("push", "workflow_dispatch", "schedule"):
        if f"\n  {event}:" in s or f"\n{event}:" in s:
            non_pr_events.append(event)

    if non_pr_events:
        print(f"{p}: shared github.ref concurrency also applies to non-PR events: {', '.join(non_pr_events)}")
PY

Repository: FastLED/FastLED

Length of output: 9053


Scope concurrency group to PRs only; use unique identifiers for non-PR runs.

GitHub Actions concurrency keeps only one pending run per group. With the current shared group based on github.workflow and github.ref, non-PR push and workflow_dispatch runs on the same branch can queue behind each other, preventing all from executing even with cancel-in-progress: false. Use github.run_id for non-PR events to give each non-PR run its own group while keeping PRs deduplicated.

Proposed fix
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/avr8js_uno_test.yml around lines 3 - 5, Change the
concurrency group to use github.run_id for non-PR events and keep PRs
deduplicated by ref: replace the current group expression with one that
evaluates to "${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
github.ref || github.run_id }}" and update cancel-in-progress to be conditional
(set to "${{ github.event_name == 'pull_request' }}" so only PR runs cancel
in-progress runs). This touches the concurrency `group` and `cancel-in-progress`
entries in the workflow.

Comment on lines +3 to +5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

GitHub Actions concurrency behavior: when cancel-in-progress is false, does the platform still cancel/replace older pending runs in the same concurrency group?

💡 Result:

Yes, when cancel-in-progress is false, the GitHub Actions platform still cancels (replaces) older pending runs in the same concurrency group. Concurrency ensures at most one running and one pending job/workflow per group. When a new run is queued and there is already one running, the new one becomes pending and cancels any existing pending run, replacing it. Running jobs are not canceled unless cancel-in-progress: true.

Citations:


Concurrency group will suppress queued master pushes

The shared concurrency group for all master pushes will cause pending runs to be dropped when multiple pushes arrive in quick succession. GitHub Actions maintains at most one running and one pending run per concurrency group; any new queueing run replaces the existing pending one. With cancel-in-progress: false, running jobs are preserved, but intermediate pending runs will never execute—conflicting with the goal of completing master validations end-to-end.

Use a unique key for push events (e.g., github.sha) while keeping github.ref for pull requests:

Recommended fix
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_esp32c2.yml around lines 3 - 5, The concurrency
group currently uses a shared key that collapses multiple master pushes; update
the concurrency.group expression to use github.ref for pull_request events but
github.sha for push events (e.g. change concurrency.group to something like ${{
github.workflow }}-${{ github.event_name == 'pull_request' && github.ref ||
github.sha }}), and leave concurrency.cancel-in-progress behaviour as-is
(cancel-in-progress: ${{ github.event_name == 'pull_request' }}) so PRs still
cancel pending runs while pushes get unique queue keys.

Comment on lines +3 to +5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

GitHub Actions concurrency cancel-in-progress false pending workflow run canceled same concurrency group github.run_id fallback

💡 Result:

In GitHub Actions, when using concurrency with cancel-in-progress: false, a concurrency group allows at most one running and one pending workflow run or job at a time. When a new run is queued for the same group: - If there is a running run, the new one becomes pending (without canceling the running one). - If there is already a pending run in the group, the existing pending run is canceled, and the new queued run takes its place as the pending one. This behavior occurs regardless of whether the concurrency group uses github.run_id as a fallback (e.g., group: ${{ github.head_ref || github.run_id }}). The github.run_id fallback ensures a unique group name when github.head_ref is undefined (e.g., non-PR events), preventing conflicts across different runs. However, if multiple triggers produce the same group name (not using a unique run_id), a pending run can still be canceled by a newer queued run in that shared group. The cancellation of pending runs is the default behavior to enforce the "one running + one pending" limit; cancel-in-progress: false only prevents canceling running (in-progress) runs, not pending ones. Example workflow snippet from docs: concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: false Here, runs with the same head_ref (same PR/branch) share a group. A new push/PR update queues a new run, which cancels any existing pending run in that group and becomes the new pending run (while letting any running run finish). This is confirmed in official GitHub docs and discussed in issues like actions/runner#3722, where users observe pending jobs canceling despite cancel-in-progress: false.

Citations:


Use a unique group for non-PR runs.

Line 4 groups every push to master into the same concurrency group. Even with Line 5 set to false for pushes, GitHub Actions can still replace older pending runs in that group, so queued master validations may be dropped instead of running end-to-end. GitHub Actions concurrency limits each group to one running and one pending run; when a new run queues for the same group with an existing pending run, the pending run is canceled and replaced—regardless of cancel-in-progress: false (which only protects running runs).

Proposed fix
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_teensy41_ofled.yml around lines 3 - 5, Change the
concurrency group so non-PR runs use a unique group (preventing queued
push/master validations from canceling each other): replace the current group
expression (group: ${{ github.workflow }}-${{ github.ref }}) with a conditional
that keeps the existing stable group for PRs but appends a unique run identifier
for non-PR events (use the existing cancel-in-progress expression
github.event_name == 'pull_request' and append github.run_id for non-PRs),
updating the concurrency.group line that references ${{ github.workflow }} and
${{ github.ref }} to include ${{ github.run_id }} when github.event_name !=
'pull_request'.

Comment on lines +3 to +5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat .github/workflows/build.yml

Repository: FastLED/FastLED

Length of output: 2364


Remove or fix the ineffective cancel-in-progress condition in this push-only workflow.

The workflow has no pull_request trigger, so github.event_name is always 'push'. This makes the condition cancel-in-progress: ${{ github.event_name == 'pull_request' }} always false, which doesn't provide the intended PR cancellation behavior. Either remove the concurrency block if serializing master pushes is unintended, or use a condition appropriate for push-only workflows.

Option A: remove the no-op concurrency block for this push-only workflow
 name: build
 
-concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
-
 on:
Option B: keep the pattern but make non-PR runs unique
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
name: build
on:
Suggested change
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build.yml around lines 3 - 5, The concurrency block is
ineffective because cancel-in-progress: ${{ github.event_name == 'pull_request'
}} will always be false in this push-only workflow; either remove the entire
concurrency block (remove the concurrency: group/cancel-in-progress keys) if you
don't want serializing pushes, or change cancel-in-progress to a
push-appropriate expression (e.g. true to cancel previous runs for the same
group) and/or adjust group (currently using group: ${{ github.workflow }}-${{
github.ref }}) to produce the desired uniqueness; update the concurrency keys
(concurrency, group, cancel-in-progress) accordingly.

Comment on lines +3 to +5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if the workflow file exists and view its content
cat -n .github/workflows/header-perf.yml 2>/dev/null || echo "File not found"

Repository: FastLED/FastLED

Length of output: 3680


🌐 Web query:

GitHub Actions concurrency pending run replacement behavior cancel-in-progress

💡 Result:

In GitHub Actions, concurrency groups limit execution to at most one running and one pending job or workflow run at a time. When a new job or workflow with the same concurrency group is queued: - If there is a job/workflow in progress (running), the new one becomes pending. - Any existing pending job/workflow in the group is automatically canceled, and the new queued one takes its place. The 'cancel-in-progress: true' option additionally cancels any currently running (in-progress) job/workflow, allowing the new one to proceed immediately. If false (default), the running one completes first, then the pending new one starts. This ensures the latest trigger replaces prior pending runs, preventing queue buildup. Ordering of runs in the group is not guaranteed. Example workflow YAML: on: push: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: example: runs-on: ubuntu-latest steps: - run: echo "Latest run" No changes to this behavior in recent changelogs (up to 2026).

Citations:


Make non-PR concurrency groups unique to preserve master/main validation.

Line 4 groups every push run for refs/heads/master or refs/heads/main together. In GitHub Actions, when a new run is queued to the same concurrency group, any existing pending run in that group is automatically canceled and replaced—even when cancel-in-progress is false. Per GitHub's official documentation (https://docs.github.com/en/actions/using-jobs/using-concurrency), the cancel-in-progress setting only controls whether currently running jobs are canceled; pending job replacement happens regardless. This means intermediate master/main validation runs can be skipped under backlog, conflicting with the stated objective.

Keep PR runs grouped by branch, but give non-PR runs a unique group:

Proposed fix
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/header-perf.yml around lines 3 - 5, Current concurrency
grouping groups all non-PR pushes by branch which causes pending master/main
pushes to be replaced; update the concurrency.group expression so PR runs remain
grouped by workflow+ref but non-PR runs include a unique identifier (e.g.,
github.run_id) so each push validation is its own group; implement this by
changing the group expression that currently uses github.workflow and github.ref
(and checks github.event_name) to conditionally append github.run_id when
github.event_name != 'pull_request' while leaving PR behavior unchanged, and
keep the existing cancel-in-progress handling.

@zackees
zackees merged commit 4a79132 into master Apr 18, 2026
63 of 87 checks passed
@zackees
zackees deleted the ci/workflow-concurrency-groups branch August 30, 2026 22:22
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.

1 participant