Skip to content

ci: supersede stale PR build runs + skip draft PRs - #713

Open
finger563 wants to merge 2 commits into
mainfrom
feat/ci-pr-concurrency
Open

ci: supersede stale PR build runs + skip draft PRs#713
finger563 wants to merge 2 commits into
mainfrom
feat/ci-pr-concurrency

Conversation

@finger563

Copy link
Copy Markdown
Contributor

What & why

Two CI ergonomics improvements to the heavy build workflows:

  1. Supersede stale runs — a new commit on a PR now cancels that PR's in-progress build runs, so we don't burn minutes finishing builds for a commit that's already been replaced.
  2. Skip draft PRs — build CI no longer runs on draft PRs (still runs on ready PRs and on push-to-main / releases).

Changes

Added to build.yml, build_libraries.yml, and build_wheels.yml:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  • Keyed by PR number (globally unique — unlike head-branch names, which two fork PRs can collide on), falling back to github.ref for push/release.
  • cancel-in-progress is gated to pull_request so push-to-main and release runs are never cancelled (the one nuance vs. rtps_interop.yml, which this mirrors but which is PR-only).

Draft guard on each heavy build job:

if: github.event_name != 'pull_request' || github.event.pull_request.draft == false

(Applied to build; build_windows/build_linux/build_macos; build_wheels/build_sdist. Push-to-main is unaffected since the event isn't pull_request.)

Left unchanged (intentional)

publish_pypi (release-only, never on PRs), static_analysis, build_and_publish_docs, upload_components (not PR build matrices), and rtps_interop.yml (already has the pattern).

Verification

YAML validity checked for each edited workflow; logic reviewed (triggers intact, draft guard never skips main, concurrency group correct). GitHub Actions can't run locally, so this is validity + review.

🤖 Generated with Claude Code

Add concurrency groups to the heavy build workflows (build.yml esp32
example matrix, build_libraries.yml host C++/Python libs, and
build_wheels.yml Python wheels) so that pushing a new commit to a PR
cancels the earlier in-progress run. The group is keyed by workflow +
PR number (globally unique, unlike head branch names which can collide
across forks), falling back to github.ref. cancel-in-progress is gated
to pull_request events so push-to-main and release runs are never
cancelled.

Add a job-level draft guard to each heavy build job so build CI is
skipped for draft PRs while still running on push-to-main and non-draft
PRs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 15, 2026 01:33
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Improves CI ergonomics for heavy build workflows by canceling stale PR runs on new commits and skipping build jobs for draft PRs.

Changes:

  • Added workflow-level concurrency with PR-number grouping and PR-only cancel-in-progress gating.
  • Added job-level if: conditions to skip heavy build jobs on draft PRs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/build.yml Adds concurrency + draft-PR job guard to reduce wasted CI cycles on PR updates.
.github/workflows/build_libraries.yml Adds concurrency + draft-PR job guards for OS build jobs.
.github/workflows/build_wheels.yml Adds concurrency + draft-PR job guards for wheel/sdist builds.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml
…lows

Use github.run_id (unique per run) instead of github.ref as the
concurrency-group fallback so non-PR runs (push, release) never
serialize or cancel each other. Add ready_for_review to the
pull_request trigger types so marking a draft PR ready triggers a
build (the draft guard otherwise skips draft PRs, leaving them
un-built until the next push).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@finger563
finger563 requested a balanced review from Copilot August 15, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

.github/workflows/build.yml:27

  • The PR description states the concurrency group falls back to github.ref for non-PR events, but the implementation falls back to github.run_id. Either update the PR description to match the implemented behavior, or change the workflow to use github.ref (per the description) if you intended to group non-PR runs by ref.
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

.github/workflows/build_wheels.yml:33

  • In this workflow, on: only includes pull_request, so the comment block describing non-PR events (push/release) and the run_id fallback is misleading here. Consider trimming the comment to PR-only behavior (or adding the relevant triggers if non-PR events are actually intended for this workflow).
# Supersede in-progress runs: a new commit on the same PR cancels the earlier,
# now-stale build. Keyed by the workflow (so it never cross-cancels other
# workflows) + the PR number, which is globally unique - unlike the head branch
# name, two fork PRs can't collide on it. For non-PR events (push, release) we
# fall back to github.run_id, which is unique per run, so those runs each get
# their own group and never serialize or cancel each other.
# cancel-in-progress is gated to pull_request events only so that push-to-main
# (and release) runs are never cancelled.

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.

2 participants