Skip to content

ci: always-report Build Module + Upstream-Compatibility gates (enable required checks)#228

Merged
SamErde merged 5 commits into
mainfrom
ci/required-check-gates
Jun 1, 2026
Merged

ci: always-report Build Module + Upstream-Compatibility gates (enable required checks)#228
SamErde merged 5 commits into
mainfrom
ci/required-check-gates

Conversation

@SamErde
Copy link
Copy Markdown
Owner

@SamErde SamErde commented Jun 1, 2026

Summary

Prerequisite for adding required status checks (point 1). Today the "Protect Main" ruleset has no required status checks, so gh pr merge --auto (Dependabot) can complete before the build/drift checks pass. But simply marking the existing checks "required" would deadlock non-bundle PRs, because Build Module and Upstream-Compatibility are path-filtered — a required check from a workflow that never triggers stays Pending forever.

This PR makes both gate workflows always trigger on PRs but short-circuit internally, so their checks always report:

  • A lightweight changes / pr-changes job (gh pr view --json files) detects whether build/tooling-relevant paths changed.
  • The heavy job runs when relevant (real result) and is skipped otherwise — a skipped job satisfies a required check, so docs-/CI-only PRs are never blocked.
  • Build Module is reused by Release via workflow_call — the build if always builds when inputs.ref is set (release) or on workflow_dispatch, and errs toward building on any ambiguity, so the release path is never accidentally skipped.

Why not a parallel "status shim"?

A shim workflow that reports the same check name on the inverse paths has a safety hole: on a PR touching both bundle and non-bundle files, both the real check and the shim run, and a passing shim can mask a failing real build. The internal short-circuit reports exactly one result per PR.

Follow-up (separate step)

Once this is merged and the skip-path behavior is confirmed on a non-bundle PR, add a required_status_checks rule to the ruleset: Build gate, Validate upstream compatibility tooling, dependency-review.

🤖 Generated with Claude Code

…r required checks

Prereq for adding required status checks. Both workflows were path-filtered, so a required check from them would stay Pending (and block) on PRs that don't trigger the workflow (docs/CI-only). Remove the pull_request path filters and gate the heavy jobs internally:
- A lightweight changes/pr-changes job (gh pr view --json files) detects whether build/tooling-relevant paths changed.
- The build matrix / pr-smoke job runs when relevant (real result) and is skipped otherwise (a skipped job satisfies a required check, so non-bundle PRs are never blocked).
- Build Module is reused by Release via workflow_call: the build  always builds when inputs.ref is set (release) or on workflow_dispatch, and errs toward building on any ambiguity, so the release path is never accidentally skipped.
Chose this over a parallel status-shim workflow, which can mask a failing build on a mixed-path PR (same context reported twice).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 13:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@SamErde
Copy link
Copy Markdown
Owner Author

SamErde commented Jun 1, 2026

@codex review

@codacy-production
Copy link
Copy Markdown
Contributor

codacy-production Bot commented Jun 1, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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

This PR updates the CI gating strategy so two previously path-filtered workflows always trigger on PRs targeting main, enabling them to be configured as required status checks without leaving PRs stuck in Pending when the workflow wouldn’t have run.

Changes:

  • Remove pull_request.paths filters from Build Module and Upstream Compatibility workflows, and instead gate the expensive validation/build jobs internally.
  • Add lightweight PR file-change detection jobs (changes / pr-changes) that decide whether the heavyweight job should run or be skipped.
  • Ensure the Build Module matrix job can still run for workflow_call (release) and workflow_dispatch, even when the PR-change detection job is skipped.

Reviewed changes

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

File Description
.github/workflows/Upstream-Compatibility.yml Always triggers on PRs to main; adds pr-changes job and gates the PR tooling validation job based on detected relevant paths.
.github/workflows/Build Module.yml Always triggers on PRs to main; adds changes job and gates the matrix build based on detected relevant paths while still building for workflow_call/manual runs.

Comment thread .github/workflows/Upstream-Compatibility.yml Outdated
Comment thread .github/workflows/Build Module.yml Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2d7e35793

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Build Module.yml Outdated
Comment thread .github/workflows/Upstream-Compatibility.yml Outdated
- P1 (Codex): a matrix job skipped via job-level if never creates its per-OS
  check contexts (if is evaluated before matrix expansion), so requiring
  "Build and test module (os)" would leave non-bundle PRs stuck waiting.
  Add an always-running aggregate "Build gate" job as the stable required-check
  target (passes when the matrix build succeeded or was skipped).
- P2 (Codex): gh pr view --json files caps at 100 files; a later src/ change on
  a large PR could be missed. Switch both detectors to the paginated REST files
  endpoint (gh api .../files --paginate).
- Copilot + Codex: make detection fail-safe. The detect step now defaults to
  relevant=true on any error, and Upstream-Compatibility's pr-smoke job uses
  always() + relevant != 'false' so a detector failure runs the validation
  rather than skipping a required check on a relevant PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b68781517a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/Build Module.yml Outdated
Comment thread .github/workflows/Upstream-Compatibility.yml Outdated
Comment thread .github/workflows/Build Module.yml Outdated
Comment thread .github/workflows/Upstream-Compatibility.yml Outdated
…ames

Second Codex pass on #228:
- Check $LASTEXITCODE after the gh api call: pwsh does not reliably throw on a
  native non-zero exit, so a transient/permission failure that emitted no output
  could otherwise write relevant=false and skip a required check. Now it throws
  into the catch (relevant=true, fail-safe).
- Project .previous_filename alongside .filename so a rename that moves a tracked
  file OUT of a matched tree is still detected as relevant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 13:52
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

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

Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Upstream-Compatibility.yml
Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Upstream-Compatibility.yml
Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Build Module.yml
Comment thread .github/workflows/Upstream-Compatibility.yml
…te logic)

Copilot review on #228: the PR-file detection was duplicated in Build Module and
Upstream-Compatibility, and it is merge-gate-critical (pagination, rename handling,
fail-safe) so the copies could drift. Extract the now-final logic into
.github/ci-scripts/Get-DLLPickleChangedPathRelevance.ps1 (parameterized by the
regex pattern set) and call it from both detection jobs (each now checks out the
repo). A scoped, justified PSAvoidUsingWriteHost suppression documents that the
script writes Actions log/annotation lines to stdout by design.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 14:02
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a8ce011e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/Upstream-Compatibility.yml Outdated
Comment thread .github/workflows/Build Module.yml Outdated
Codex flagged a P1 on the extracted .github/ci-scripts detector: pull_request runs
the PR's checked-out copy, so a PR could modify the shared gate script to emit
relevant=false while changing src/, skipping the build while Build gate passes.
Reverting to inline detection keeps the merge-gate logic in the workflow file,
which benefits from GitHub's stricter workflow-edit review (and a related P2: the
shared-script path wasn't in the upstream relevance set). The small duplication
Copilot flagged is accepted as the security tradeoff; a note in each detector
documents that it is inline on purpose.

This reverts commit 1a8ce01 and adds the explanatory note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@SamErde SamErde merged commit 90f1603 into main Jun 1, 2026
18 checks passed
@SamErde SamErde deleted the ci/required-check-gates branch June 1, 2026 14:23
SamErde added a commit that referenced this pull request Jun 1, 2026
* docs: require Build gate (not per-OS legs) in the §9 required-checks note

Aligns the architecture note with #228: the gate workflows now always report
(skip == passing check), so they can be required without blocking docs-/CI-only
PRs. The matrix build's required-check target is the always-present aggregate
"Build gate" (the per-OS "Build and test module (...)" contexts aren't created
when the matrix job is skipped). Required set: Build gate, Validate upstream
compatibility tooling, dependency-review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: reword Dependabot-Auto-Approve reference to match the workflow header

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
SamErde added a commit that referenced this pull request Jun 2, 2026
…tartup failure) (#232)

fix(ci): grant pull-requests: read to the release build-and-test caller

Release-and-Publish startup_failed on both pull_request:closed and
workflow_dispatch after #228, so 2.2.0 never published.

Root cause: #228 added a "changes" job to the reusable Build Module.yml
that declares pull-requests: read. Release calls that workflow via uses:,
and its build-and-test caller granted only contents: read +
security-events: write. A reusable workflow's jobs may not request
permissions the caller did not grant; GitHub validates this STATICALLY at
startup (before any if: skip), so even though "changes" is skipped on the
workflow_call path, the excess request fails the whole run before it starts.

Grant pull-requests: read on the caller so static validation passes. The
permission is unused on the release path (the "changes" job is skipped
there) and is read-only and minimal.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants