Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk3 min

How to Configure GitHub Actions Concurrency for Pull Requests and Deployments

Choose workflow-level concurrency to replace stale pull-request checks, or job-level concurrency with queue: max to serialize deployments without replacing pending work.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use workflow-level concurrency to cancel outdated pull-request checks, and job-level concurrency with queue: max when a deployment target must process a backlog without replacing pending releases. The right group key defines exactly which runs share that behavior.

How GitHub Actions concurrency works

A concurrency group is a shared key that limits matching work to one running item at a time. You can set it at the workflow level or on an individual job. By default, a group retains only one pending run or job: when another item enters the group, it replaces the previous pending item. See GitHub’s concurrency overview.

Workflow-level concurrency

Place concurrency beside on and jobs to gate entire workflow runs. This is useful when a newer run makes the whole older run unnecessary, such as pull-request validation after another commit arrives.

Job-level concurrency

Place concurrency inside a job to serialize only that job. Other jobs in the same workflow, such as tests or packaging, can continue without waiting for the deployment lock. This is often the better scope when only a shared deployment target must be protected.

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

Cancel outdated pull-request checks

For checks where only the latest commit matters, set a branch-specific group and cancel the active run when a newer run joins it. For a workflow handling pull requests and pushes to main:

name: CI

on:
  pull_request:
  push:
    branches: [main]

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

github.head_ref identifies the source branch for a pull-request event, but is not defined for every event. The fallback to github.ref gives the push event a group value too. Including github.workflow helps keep different workflows from sharing a group unintentionally. Confirm that runs of this same workflow on the same branch are meant to replace one another before enabling cancellation.

If a workflow runs only on pull requests, GitHub’s documented pattern can use github.head_ref || github.run_id when a unique fallback is wanted. The run ID prevents unrelated events without a pull-request branch from being grouped together.

Serialize deployments without discarding pending releases

For a deployment that must finish and should not lose queued work, put concurrency on the deployment job and use queue: max. Key the group to the destination so deployments to the same target wait behind one another:

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

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production
    concurrency:
      group: production-deploy
      queue: max
    steps:
      - name: Deploy
        run: ./deploy.sh

Current GitHub workflow syntax documents up to 100 pending workflow runs or jobs per group with queue: max. When the group reaches that capacity, additional work is canceled. The queue does not promise strict event-dispatch order: GitHub processes work according to when it started waiting, and says ordering is not guaranteed because those waiting start times can vary.

queue: max cannot be combined with cancel-in-progress: true. If you leave out the queue policy, the default keeps only one pending item, so a newer deployment can replace an older pending deployment. That latest-pending behavior may suit disposable preview environments, but not releases that all need to run.

Concurrency and environment protections do different jobs

Concurrency prevents overlapping work for a group. A GitHub Actions environment can separately apply deployment controls such as required reviewers, branch restrictions, and access to environment secrets. Configure both when needed; an environment does not replace the concurrency lock. See GitHub’s deployment controls documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose a group key that matches the work

  • Pull-request checks: identify the workflow and branch so commits on that branch supersede stale checks without colliding with unrelated workflows.
  • Production deployments: use a stable key for the production target, such as production-deploy, so every job deploying there shares the same lock.
  • Separate environments: include the target identity in the key, such as staging versus production, if they should proceed independently.

Group names are case-insensitive, and groups are shared within a repository. Two workflows using the same group can therefore interact even if they have different names elsewhere. Choose distinctive keys unless cross-workflow coordination is intentional. The workflow syntax reference documents the case-insensitive behavior.

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

Inspect and manage concurrency groups

GitHub provides REST API endpoints for inspecting and managing Actions concurrency groups. Use the REST API reference when you need to examine group state programmatically or manage groups through automation.

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.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

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.