DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

Why GitHub Actions Cancels the Wrong Run—and How to Fix Concurrency Groups

GitHub Actions can cancel a different workflow when both resolve to the same concurrency group. Learn how pending-run replacement works and how to configure isolation, cancellation, or a queue.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

GitHub Actions usually cancels a run because it shares a concurrency group with other work—not because it has chosen arbitrarily. Compare the group keys and cancellation settings for the affected workflow runs. By default, a new run replaces the existing pending run in the same group; it cancels a run that is already running only when cancel-in-progress is enabled. The fix is to make the group intentionally shared or distinct, then choose whether matching work should replace, wait, or proceed independently.

Why a different run gets canceled

A concurrency group is the scope in which GitHub Actions coordinates workflow runs or jobs that use the same group key. Group names are case-insensitive, and groups can be shared across workflows in the same repository. So a generic key such as ci, or a key based only on a branch name, may make unrelated workflows match.

There are two different cancellation cases to check:

  • Pending run replaced: With the default queue: single behavior, a group can have one pending run. When new work enters that group, it cancels and replaces the previous pending run.
  • Running work canceled: A newer matching run can cancel work that is already running when its concurrency configuration sets cancel-in-progress: true.

GitHub describes the default pending behavior this way: “By default, any existing pending job or workflow in the same concurrency group will be canceled and the new queued job or workflow will take its place.” See GitHub’s concurrency documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To find the cause, inspect the affected runs’ workflow and job-level concurrency settings. Expand their expressions for the relevant event and compare the resulting group strings, including capitalization-insensitive matches. A workflow-level group and a job-level group can each affect concurrency; look at the configuration for the work that was canceled rather than assuming every run uses the same key.

Choose a group key that matches what should coordinate

Include dimensions that should separate work, such as workflow identity and branch or ref. Leave a dimension out only when you deliberately want those runs to coordinate—for example, when separate workflows deploy to the same environment.

Cancel obsolete checks for the same workflow and ref

For CI where only the newest commit on a branch needs to complete, GitHub documents this pattern:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

The workflow and ref make separate workflows and refs distinct, while the cancellation setting lets newer matching work supersede work already running. If only some branches should cancel running work, make cancel-in-progress an expression that reflects that policy rather than enabling it unconditionally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a fallback when a context value may be absent

github.head_ref is available for pull-request events but may not be set for other event types. GitHub shows a fallback to the unique run ID for that situation:

concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

Choose the fallback based on the intended coordination: a unique run ID prevents unrelated events without a head ref from joining one shared group.

Decide whether matching work should cancel, wait, or replace

Work or goal Group design Policy to consider
CI checks made obsolete by a newer push Workflow identity plus branch or ref Set cancel-in-progress: true if stopping older work is acceptable.
Deployments to one shared environment A deliberately shared environment or deployment key Leave active work uncanceled; use a queue if each deployment must run.
Independent workflows or branches Include workflow identity and the relevant ref Keep group keys distinct to avoid unintended interaction.
Release or migration work that must finish A dedicated release or target key Do not cancel in-progress work; consider a queue for pending runs.

To preserve the active run, omit cancel-in-progress or set it to false. That alone does not preserve every pending run: default single-pending behavior still replaces the older pending run when new work queues in the group.

To let more pending work wait, use queue: max:

concurrency:
  group: production-deploy
  queue: max

GitHub documents capacity for up to 100 pending jobs or workflow runs in this queue mode. Additional runs are canceled when the queue is full. queue: max cannot be combined with cancel-in-progress: true, so it is not a way to retain a backlog while also canceling active matching work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Account for ordering and cancellation behavior

Concurrency is not a strict first-in, first-out guarantee based on workflow dispatch time. GitHub says work is processed according to when it started waiting on the group, and actual start time can vary. Do not rely on the group to guarantee that commits or deployments run in dispatch order.

Cancellation is not necessarily instantaneous. GitHub reevaluates running jobs’ if conditions during cancellation; a condition such as always() can keep a job running. For work selected for cancellation, the runner interrupts the step process and may escalate if it does not stop. GitHub documents a five-minute cancellation timeout before forced termination. See the workflow cancellation reference.

Check active groups when the YAML does not make the cause obvious

Inspect the affected run’s workflow and job configuration, then compare its resolved group with other active work in the repository. GitHub also documents a REST API endpoint for listing active concurrency groups: List pending deployments for a repository. Use the active group information alongside the workflow expressions; seeing matching names points to shared coordination, while the cancellation and queue settings determine what that match permits.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.