Skip to content

[no-ci] CI: add dedicated merge gate for restricted-paths review#1896

Open
rwgk wants to merge 3 commits intoNVIDIA:mainfrom
rwgk:make_Needs-Restricted-Paths-Review_merge-blocking
Open

[no-ci] CI: add dedicated merge gate for restricted-paths review#1896
rwgk wants to merge 3 commits intoNVIDIA:mainfrom
rwgk:make_Needs-Restricted-Paths-Review_merge-blocking

Conversation

@rwgk
Copy link
Copy Markdown
Collaborator

@rwgk rwgk commented Apr 12, 2026

Summary

Follow-on to PR #1878

Add a dedicated GitHub Actions workflow, restricted-paths-review-gate.yml, that fails when the Needs-Restricted-Paths-Review label is present on a PR.

This keeps the merge-blocking behavior narrowly scoped to the restricted-paths policy, instead of making the broader checks in pr-metadata-check.yml required.

Why a separate workflow

  • pr-metadata-check.yml is not currently merge-blocking.
  • Reusing pr-metadata-check.yml would mix two different policies:
    PR metadata hygiene and restricted-paths review.
  • A dedicated gate gives us one required check with one clear meaning:
    if Needs-Restricted-Paths-Review is present, merging is blocked until a maintainer removes the label.

Behavior

  • The existing restricted-paths-guard.yml workflow continues to assign Needs-Restricted-Paths-Review when an untrusted author touches cuda_bindings/ or cuda_python/.
  • The new restricted-paths-review-gate.yml workflow reads the live PR labels and:
    • fails if Needs-Restricted-Paths-Review is present
    • passes otherwise
  • This is implemented as a separate pull_request_target workflow so it can be used as a required status check in branch protection / rulesets.

Important rollout detail

This PR adds the workflow only. The check does not become merge-blocking until a repo admin adds the new check to the repository ruleset after this PR is merged.

Post-merge admin steps

  1. Open or update a PR so the new workflow runs at least once from the base branch, and GitHub records the check context.
  2. Go to Settings -> Rules -> Rulesets -> Prevent committing without PR.
  3. Edit Required status checks.
  4. Add the check named Restricted paths review gate.
  5. Save the ruleset.
  6. Verify on a PR with Needs-Restricted-Paths-Review: merging should be blocked while the label is present, and unblocked after a maintainer removes it.

Branch-scope note

The existing Prevent committing without PR ruleset applies to:

  • main
  • 12.9.x
  • 11.8.x
  • release/**/*

If the new gate should apply to all of those branches, editing that existing ruleset is the right approach.

If the new gate should apply only to main, the better follow-up is to create a separate ruleset scoped only to refs/heads/main and require Restricted paths review gate there.


Made with Cursor GPT-5.4 Extra High Fast

Add a dedicated workflow that fails when the Needs-Restricted-Paths-Review label is present. This gives branch protection a narrowly scoped merge gate for restricted-paths policy without making the broader PR metadata checks required.

Made-with: Cursor
@rwgk rwgk added this to the cuda.bindings next milestone Apr 12, 2026
@rwgk rwgk self-assigned this Apr 12, 2026
@rwgk rwgk added P0 High priority - Must do! CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module labels Apr 12, 2026
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot bot commented Apr 12, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Temporarily switch the new workflow to pull_request so PR NVIDIA#1896 can exercise the label-driven pass/fail behavior before the workflow exists on the base branch. This lets us validate the gate logic pre-merge and then switch back to pull_request_target for the final rollout.

Test plan:
1. Temporarily switch the new workflow to `pull_request`.
2. Push to PR `NVIDIA#1896`.
3. Add the label and confirm the check goes red.
4. Remove the label and confirm the check goes green.
5. Switch it back to `pull_request_target` before merging.

Made-with: Cursor
@rwgk rwgk added Needs-Restricted-Paths-Review PR touches cuda_bindings or cuda_python; only NVIDIA employees may modify these paths; see LICENSEs and removed Needs-Restricted-Paths-Review PR touches cuda_bindings or cuda_python; only NVIDIA employees may modify these paths; see LICENSEs labels Apr 12, 2026
@rwgk rwgk marked this pull request as ready for review April 12, 2026 22:33
@rwgk
Copy link
Copy Markdown
Collaborator Author

rwgk commented Apr 12, 2026

Smoke testing, as described in the message of commit 2b94e27:

Manually add Needs-Restricted-Paths-Review label

Screenshot 2026-04-12 at 15 29 42

Summary of failed (as expected) workflow

Screenshot 2026-04-12 at 15 30 29

Manually remove Needs-Restricted-Paths-Review label

Screenshot 2026-04-12 at 15 31 38

Summary of successful workflow

Screenshot 2026-04-12 at 15 32 09

@rwgk rwgk requested review from aterrel, leofang and rparolin April 12, 2026 22:40
@rwgk
Copy link
Copy Markdown
Collaborator Author

rwgk commented Apr 12, 2026

@aterrel I think the chance of something still slipping through the cracks is very small:

  • The Needs-Restricted-Paths-Review label is sticky: it is only added automatically, never removed automatically.
  • The automatic exemption is narrowly defined: the label is not added only when the PR author is a COLLABORATOR, MEMBER, or OWNER, and those trusted associations are tightly controlled by repository/organization administration.
  • Only someone with repository triage-or-higher access can remove the label before merging, which is a fairly small group of people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant