Skip to content

ci: restore push on all branches, avoid duplicate runs#4665

Merged
escapedcat merged 1 commit intomasterfrom
ci/check-duplication-runs
Mar 18, 2026
Merged

ci: restore push on all branches, avoid duplicate runs#4665
escapedcat merged 1 commit intomasterfrom
ci/check-duplication-runs

Conversation

@escapedcat
Copy link
Copy Markdown
Member

@escapedcat escapedcat commented Mar 17, 2026

Reverts the push trigger from master-only back to "**" (all branches) so
contributors can see CI status on their fork branches before opening a PR
(reverts part of #4660, restores #3840).

To avoid duplicate CI runs when a maintainer pushes to a branch with an open
PR, each job skips pull_request events from the same repository — the same
approach used by Vue.js:

  • Push events: always run
  • Pull request events: only run if the PR is from a fork
  • Schedule/workflow_dispatch: always run

This avoids the "50% broken CI" visual noise that concurrency groups cause
(cancelled jobs show as failures in the GitHub UI).

@escapedcat escapedcat requested a review from Copilot March 17, 2026 10:40
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Restore push on all branches and add concurrency deduplication

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Restore push trigger to all branches for pre-PR CI visibility
• Add concurrency group to cancel duplicate workflow runs
• Prevent redundant CI execution on push and pull_request events
Diagram
flowchart LR
  A["Push trigger"] -->|"changed from master only"| B["All branches **"]
  C["Pull request trigger"] -->|"same branch"| D["Concurrency group"]
  B -->|"deduplicate"| D
  D -->|"cancel-in-progress"| E["Single workflow run"]
Loading

Grey Divider

File Changes

1. .github/workflows/CI.yml ⚙️ Configuration changes +5/-1

Expand push trigger and add concurrency deduplication

• Changed push trigger from master branch only to "**" (all branches)
• Added concurrency configuration with group based on workflow and branch name
• Enabled cancel-in-progress to terminate duplicate runs when both push and pull_request events
 trigger

.github/workflows/CI.yml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Mar 17, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Schedule run cancellations 🐞 Bug ⛯ Reliability
Description
Because workflow-level cancel-in-progress: true uses the same concurrency group for all events, a
scheduled run on the default branch can be canceled if a push-triggered run on that branch starts
while the schedule is still executing. This can intermittently prevent scheduled CI from completing
and reduce periodic signal.
Code

.github/workflows/CI.yml[R16-18]

+concurrency:
+  group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
+  cancel-in-progress: true
Evidence
The workflow defines both a nightly schedule trigger and a workflow-level concurrency policy with
cancel-in-progress: true. For scheduled runs github.head_ref is empty, so the group falls back
to github.ref_name (the default branch ref), which can match the group used by push runs on that
same branch and lead to cancellation if they overlap in time.

.github/workflows/CI.yml[12-18]
.github/workflows/CI.yml[4-6]

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 cancellation applies to `schedule` events too, so the nightly run can be canceled by a concurrently-started push run on the default branch.

### Issue Context
We want to cancel duplicate push/pull_request runs, but scheduled runs are periodic signal and usually should be allowed to complete.

### Fix Focus Areas
- .github/workflows/CI.yml[12-18]

### Suggested change
Make schedule runs use a distinct group and disable cancel-in-progress for them, e.g.:

```yaml
concurrency:
 group: ${{ github.workflow }}-${{ github.event_name == 'schedule' && 'schedule' || (github.head_ref || github.ref_name) }}
 cancel-in-progress: ${{ github.event_name != 'schedule' }}
```

This preserves duplicate-cancellation for push/PR while keeping scheduled runs reliable.

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


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Mar 17, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restores CI visibility for contributors by running the main CI workflow on pushes to any branch (not just master), and adds workflow-level concurrency to reduce duplicated CI runs when both push and pull_request triggers fire.

Changes:

  • Expand push trigger to all branches ("**").
  • Add a concurrency group with cancel-in-progress: true to cancel duplicate in-flight runs per branch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/CI.yml Outdated
Reverts the push trigger from `master`-only back to `"**"` (all branches)
so contributors can see CI status on their fork branches before opening
a PR (see #3840).

To avoid duplicate CI runs when a maintainer pushes to a branch that has
an open PR (both push and pull_request triggers fire), each job now has
an `if` condition that skips pull_request runs from the same repository.
This is the same approach used by Vue.js (vuejs/core):

- Push events: always run
- Pull request events: only run if the PR is from a fork
- Schedule/workflow_dispatch: always run

This avoids the "50% broken CI" visual noise caused by concurrency
groups cancelling push runs, since GitHub shows cancelled jobs as
failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@escapedcat escapedcat force-pushed the ci/check-duplication-runs branch from e0a8759 to e0a545e Compare March 17, 2026 12:32
@escapedcat escapedcat changed the title ci: restore push on all branches and duplicated runs ci: restore push on all branches, avoid duplicate runs Mar 17, 2026
@knocte
Copy link
Copy Markdown
Contributor

knocte commented Mar 17, 2026

Interesting approach, but given that you're adding this if to all jobs, wouldn't removing L7 achieve the same thing?

@escapedcat
Copy link
Copy Markdown
Member Author

No, removing the pull_request trigger entirely would not achieve the same thing. The if condition still allows
pull_request events through for fork PRs

Assuming that's what you meant with L7

@escapedcat escapedcat merged commit ba60e3e into master Mar 18, 2026
20 checks passed
@escapedcat escapedcat deleted the ci/check-duplication-runs branch March 18, 2026 12:12
This was referenced Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants