Skip to content

fix: Split concurrency for builds for each branch#297

Merged
Gared merged 1 commit into
mainfrom
split_concurrency_branches
Jun 10, 2026
Merged

fix: Split concurrency for builds for each branch#297
Gared merged 1 commit into
mainfrom
split_concurrency_branches

Conversation

@Gared

@Gared Gared commented Jun 10, 2026

Copy link
Copy Markdown
Member

PR Summary by Qodo

Fix GitHub Pages workflow concurrency to be per-branch
🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 5 minutes

Grey Divider

Walkthroughs

Description
• Scope GitHub Actions concurrency group to the branch to avoid cross-branch blocking.
• Keep in-progress deployments running while allowing parallel runs on different branches.
Diagram
graph TD
  A["build-ui workflow"] --> B{"Concurrency group"} --> C["GitHub Pages deploy"]
  B --> D["Branch/ref name"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use github.workflow + github.ref for grouping
  • ➕ Avoids potential group-name collisions if multiple workflows deploy Pages
  • ➕ More explicit uniqueness across workflow files
  • ➖ Slightly more verbose
  • ➖ Not necessary if only this workflow uses the Pages concurrency group
2. Group by environment (e.g., pages-prod vs pages-preview)
  • ➕ Aligns concurrency with deployment targets rather than branches
  • ➕ Can better reflect promotion flows
  • ➖ Does not solve cross-branch blocking if all branches target same environment
  • ➖ Requires clearer environment modeling in the workflow

Recommendation: Current approach is appropriate: scoping the group to ${{ github.head_ref || github.ref_name }} directly addresses the cross-branch concurrency issue with minimal change. Consider adding ${{ github.workflow }} to the group if there is (or will be) more than one workflow deploying to Pages.

Grey Divider

File Changes

Other (1)
build-ui.yml Make Pages concurrency group branch-scoped +1/-1

Make Pages concurrency group branch-scoped

• Updates the workflow concurrency group from a single shared value ("pages") to a branch/ref-specific value ("pages-${{ github.head_ref || github.ref_name }}"). This prevents runs from different branches from blocking each other while keeping 'cancel-in-progress: false' behavior.

.github/workflows/build-ui.yml


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@Gared Gared merged commit 1ad0d79 into main Jun 10, 2026
2 checks passed
@Gared Gared deleted the split_concurrency_branches branch June 10, 2026 18:21
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 10, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0)

Grey Divider


Action required

1. PR blocks main deploy 🐞 Bug ☼ Reliability
Description
The workflow-wide concurrency key uses github.head_ref for pull_request runs, so a PR whose source
branch is named main will share the same group (pages-main) as push-to-main runs and can
queue/delay production deployments. Because cancel-in-progress: false, a long PR build can block
subsequent main deployments until it completes.
Code

.github/workflows/build-ui.yml[R21-23]

concurrency:
-  group: "pages"
+  group: "pages-${{ github.head_ref || github.ref_name }}"
  cancel-in-progress: false
Evidence
The workflow triggers on both push and pull_request targeting main, and only the deploy steps
are gated to refs/heads/main, so PR runs still participate in workflow-level concurrency. With the
new key, a PR whose head_ref is main produces the same group string as a push to main
(pages-main), causing unintended queuing between PR builds and production deploy runs.

.github/workflows/build-ui.yml[3-10]
.github/workflows/build-ui.yml[19-23]
.github/workflows/build-ui.yml[46-59]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow-level `concurrency.group` is derived from `github.head_ref || github.ref_name`, which can produce the same group name for different event types (notably `pull_request` vs `push`). This can cause non-deploying PR runs to block production deploy runs when the PR source branch name matches the protected branch name (e.g., `main`).

## Issue Context
This workflow runs on both `push` to `main` and `pull_request` targeting `main`, but only deploys when `github.ref == 'refs/heads/main'`.

## Fix Focus Areas
- .github/workflows/build-ui.yml[21-23]

## Suggested change
Make the concurrency key unique across event types (or use `github.ref`), e.g.:
- `group: "pages-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}"`

This keeps branch-based grouping while preventing `pull_request` runs from sharing the same key as `push` runs on `main`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

2. Misleading concurrency comment 🐞 Bug ⚙ Maintainability
Description
The comment says the workflow allows only one concurrent deployment, but the new branch-scoped
concurrency key allows multiple concurrent workflow runs across different branches (at least the
build job). This mismatch can mislead future edits around Pages deployment safety and queuing
behavior.
Code

.github/workflows/build-ui.yml[R19-23]

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
-  group: "pages"
+  group: "pages-${{ github.head_ref || github.ref_name }}"
  cancel-in-progress: false
Evidence
The concurrency block is workflow-wide and now includes a branch-derived suffix, so runs from
different branches will not be serialized; meanwhile the workflow includes a non-main-gated build
job that will run for PRs.

.github/workflows/build-ui.yml[19-23]
.github/workflows/build-ui.yml[25-45]
.github/workflows/build-ui.yml[57-58]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The comment above `concurrency:` no longer matches the behavior after switching to a per-branch concurrency group.

## Issue Context
The workflow runs on `pull_request` as well as `push` to `main`; only the deploy job is guarded by `github.ref == 'refs/heads/main'`.

## Fix Focus Areas
- .github/workflows/build-ui.yml[19-23]

## Suggested change
Rewrite the comment to reflect the new semantics, e.g.:
- Concurrency is per-branch (or per event+branch) to allow PR builds in parallel while still serializing `main` deployments.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines 21 to 23
concurrency:
group: "pages"
group: "pages-${{ github.head_ref || github.ref_name }}"
cancel-in-progress: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Pr blocks main deploy 🐞 Bug ☼ Reliability

The workflow-wide concurrency key uses github.head_ref for pull_request runs, so a PR whose source
branch is named main will share the same group (pages-main) as push-to-main runs and can
queue/delay production deployments. Because cancel-in-progress: false, a long PR build can block
subsequent main deployments until it completes.
Agent Prompt
## Issue description
The workflow-level `concurrency.group` is derived from `github.head_ref || github.ref_name`, which can produce the same group name for different event types (notably `pull_request` vs `push`). This can cause non-deploying PR runs to block production deploy runs when the PR source branch name matches the protected branch name (e.g., `main`).

## Issue Context
This workflow runs on both `push` to `main` and `pull_request` targeting `main`, but only deploys when `github.ref == 'refs/heads/main'`.

## Fix Focus Areas
- .github/workflows/build-ui.yml[21-23]

## Suggested change
Make the concurrency key unique across event types (or use `github.ref`), e.g.:
- `group: "pages-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}"`

This keeps branch-based grouping while preventing `pull_request` runs from sharing the same key as `push` runs on `main`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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