Skip to content

ci: cancel in-progress PR runs when new commits are pushed - #1248

Open
connorjclark wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
connorjclark:ci-cancel-in-progress
Open

connorjclark wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
connorjclark:ci-cancel-in-progress

Conversation

@connorjclark

Copy link
Copy Markdown

Currently, .github/workflows/pullrequest.yaml does not define a concurrency configuration. When new commits are pushed to an open PR—or when a stack of PRs is cascade-rebased and pushed—superseded PR Tests workflow runs on the same PR continue executing all 8 jobs to completion alongside the new run.

This PR adds a concurrency block that:

  • Groups runs by PR number (${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}), so distinct PRs in a stack continue running in parallel while superseded runs on the same PR are automatically cancelled.
  • Only enables cancel-in-progress on pull_request events, leaving merge_group runs in the Merge Queue untouched.

Estimated Impact:
Across the last 297 pull_request runs on GoogleCloudPlatform/khi (104.2 runner-hours / 6,252 runner-minutes in a 24-hour window), 121 runs (40.7% of PR runs) overlapped with a newer run on the same PR branch, accounting for ~35–36% of total PR runtime—saving roughly ~2,200 runner-minutes per day (~66,000 runner-minutes per month).

🔒 b/582381028

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@kyasbal kyasbal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@connorjclark Thank you for catching this issue. This is LGTM. So I'm gonna merge this soon.

@kyasbal
kyasbal enabled auto-merge November 10, 2026 01:15
@kyasbal

kyasbal commented Nov 10, 2026

Copy link
Copy Markdown
Member

/gcbrun

@kyasbal kyasbal added area:cicd GitHub Actions workflows and release pipelines type:chore Maintenance, dependency updates, and tooling chores labels Nov 10, 2026
@kyasbal
kyasbal disabled auto-merge November 10, 2026 02:23
@kyasbal
kyasbal enabled auto-merge November 10, 2026 02:23
@kyasbal
kyasbal disabled auto-merge November 11, 2026 02:48
@kyasbal
kyasbal enabled auto-merge November 11, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cicd GitHub Actions workflows and release pipelines type:chore Maintenance, dependency updates, and tooling chores

2 participants