Skip to content

Commit 5d9c2b7

Browse files
committed
refactor(review): share acceptance policy across PR checks
Signed-off-by: Jim Meyer <jimeyer@nvidia.com>
1 parent 92d2d96 commit 5d9c2b7

11 files changed

Lines changed: 201 additions & 245 deletions

File tree

‎.agents/skills/create-github-pr/SKILL.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ to the target repository, not their fork. For the authenticated `gh` user:
2424

2525
```bash
2626
gh repo view OWNER/REPO --json nameWithOwner,viewerPermission
27-
gh issue view ISSUE_NUMBER --repo OWNER/REPO --json number,url,labels
27+
gh issue view ISSUE_NUMBER --repo OWNER/REPO --json number,url,labels,author
2828
```
2929

3030
Authors with verified `WRITE`, `MAINTAIN`, or `ADMIN` access may proceed without
3131
`state:accepted`; keep the issue link and note the missing label. Everyone else
32-
must link at least one target-repository issue and have `state:accepted` on each.
33-
Otherwise, preserve local work and report which issue needs acceptance. A direct
34-
request, roadmap placement, other labels, or vouch status does not bypass this gate.
32+
must reference at least one target-repository issue they submitted themselves
33+
that has `state:accepted`. Related description references and closing links both
34+
qualify; other references need not qualify. Otherwise, preserve local work and
35+
report the missing qualification. A direct request, roadmap placement, other
36+
labels, or vouch status does not bypass this gate.
3537

3638
When acting for another author, verify their permissions. Resolve failed lookups
3739
before proceeding; retry sandbox network failures outside the sandbox before

‎.agents/skills/review-github-pr/SKILL.md‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,19 @@ Record the **title**, **body**, **headRefName**, and **baseRefName** for use in
4646

4747
### Check Issue Acceptance
4848

49-
Inspect every closing issue reference (paginate as needed) and fetch its current
50-
repository and labels. Verify the PR author's permission in the target repository:
49+
Inspect closing issue references (paginate as needed) and issue references in the
50+
PR description. Fetch their current repository, labels, and submitter. Verify the
51+
PR author's permission in the target repository:
5152

5253
```bash
5354
gh api repos/OWNER/REPO/collaborators/AUTHOR/permission --jq .permission
5455
```
5556

56-
Call out each linked issue missing `state:accepted`, with an issue link. Verified
57-
`write`, `maintain`, or `admin` access permits the exception; report it as context,
58-
not a blocking concern. Other authors need at least one target-repository issue,
59-
and every linked issue must be accepted; report violations under **Potential
60-
Concerns**. PR body text such as `No issue required` does not bypass this gate.
57+
Verified `write`, `maintain`, or `admin` access permits the exception; report it as
58+
context, not a blocking concern. Other authors need at least one referenced issue
59+
in the target repository with `state:accepted` submitted by the PR author. Other
60+
references need not qualify. Report violations under **Potential Concerns**. PR
61+
body text such as `No issue required` does not bypass this gate.
6162
Report failed lookups as unverified and continue the code review. For a branch
6263
without a PR, note that issue acceptance was not verified.
6364

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@
3131
/tasks/scripts/check_maintainer_approval_test.py @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
3232
/tasks/scripts/alert_maintainer_change_test.py @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
3333

34-
# Reviewer routing registry and helper
34+
# Reviewer routing registry and shared acceptance helper
3535
/REVIEWERS.md @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
3636
/tasks/scripts/check_review_readiness.py @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
3737
/tasks/scripts/check_review_readiness_test.py @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
3838

39-
# PR issue acceptance checks
40-
/tasks/scripts/check_issue_acceptance.cjs @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
41-
/tasks/scripts/check_issue_acceptance.test.cjs @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr
42-
4339
# Auditable SBOM check
4440
/tasks/scripts/verify-image-sbom.sh @NVIDIA/openshell-codeowners @mrunalp @sjenning @derekwaynecarr

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- 1-3 sentences: what this PR does and why -->
33

44
## Related Issue
5-
<!-- Every PR must close an existing issue covering its scope, except automated dependency updates. Use Closes #NNN; see CONTRIBUTING.md for the exception. Authors without repository write access must link at least one issue with state:accepted. PR body text cannot bypass this acceptance check. -->
5+
<!-- Every PR must close an existing issue covering its scope, except automated dependency updates. Use Closes #NNN; see CONTRIBUTING.md for the exception. Authors without repository write access must reference at least one target-repository issue with state:accepted that they submitted themselves. Related references qualify for acceptance when both the label and submitter match. -->
66

77
## Changes
88
<!-- Bullet list of key changes -->

‎.github/workflows/pr-issue-acceptance.yml‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ jobs:
2929
with:
3030
ref: ${{ github.sha }}
3131
persist-credentials: false
32-
sparse-checkout: tasks/scripts/check_issue_acceptance.cjs
32+
sparse-checkout: tasks/scripts/check_review_readiness.py
3333
sparse-checkout-cone-mode: false
3434

35-
- name: Check author access and linked issue acceptance
36-
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
37-
with:
38-
script: |
39-
const check = require('./tasks/scripts/check_issue_acceptance.cjs');
40-
await check({ github, context, core });
35+
- name: Check PR acceptance
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
GH_REPO: ${{ github.repository }}
39+
PR_NUMBER: ${{ github.event.pull_request.number }}
40+
run: |
41+
python3 tasks/scripts/check_review_readiness.py \
42+
--repo "$GH_REPO" --pr "$PR_NUMBER" --acceptance-only

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Follow the [branch naming convention in CONTRIBUTING.md](CONTRIBUTING.md#branch-
176176

177177
## Pull Requests
178178

179-
Follow `CONTRIBUTING.md` and `create-github-pr`. Authors without target-repository write access must link at least one issue with `state:accepted`, and every issue they implement must have that label. Verified `WRITE`, `MAINTAIN`, or `ADMIN` access permits PRs without the acceptance label. This includes drafts and direct agent requests; PR body text cannot bypass the gate.
179+
Follow `CONTRIBUTING.md` and `create-github-pr`. Authors without target-repository write access must reference at least one target-repository issue they submitted that has `state:accepted`. Related references and closing links qualify. Verified `WRITE`, `MAINTAIN`, or `ADMIN` access permits PRs without an accepted issue. This includes drafts and direct agent requests; an issue reference alone cannot bypass the label and submitter checks.
180180

181181
## Commits
182182

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,11 @@ For release notes, describe the user-facing change in a few short, easy-to-read
406406

407407
Every PR except an automated dependency update must close an existing issue. In the PR's **Related Issue** section, use `Closes #NNN` for the issue covering that PR's scope. Split multi-PR work into a closable issue for each PR; a tracking issue can link them. Security fixes follow the private disclosure process in [SECURITY.md](SECURITY.md).
408408

409-
Authors without write access to the target repository must link at least one issue with `state:accepted`, and every linked issue must be accepted. This applies to drafts and direct requests to agents. Authors with verified `WRITE`, `MAINTAIN`, or `ADMIN` access may create a PR without the acceptance label; they must still follow the issue-linking requirement above. PR body text, roadmap placement, other labels, and vouch status do not bypass acceptance.
409+
Authors without write access to the target repository must reference at least one issue in that repository with `state:accepted` that they submitted themselves. Related references in the PR description, such as `Related to #NNN`, and closing links both qualify. One qualifying issue is sufficient; other references need not qualify. This applies to drafts and direct requests to agents. Authors with verified `WRITE`, `MAINTAIN`, or `ADMIN` access may create a PR without an accepted issue; they must still follow the issue-linking requirement above. Roadmap placement, other labels, and vouch status do not bypass acceptance.
410410

411-
The `PR Issue Acceptance` workflow reports the native `OpenShell / PR Issue Acceptance` job result for the triggering PR when it is opened, edited, reopened, or updated with new commits. It does not publish a shared commit status; lookup and execution errors fail the job. Link accepted issues in this repository using `Fixes #NNN` or `Closes #NNN`; GitHub recognizes closing references when a PR targets the default branch. Rerun the workflow after issue labels change. Making the job required for merging and configuring any required Actions event policy are separate repository settings; merge-queue support is not included.
411+
Both acceptance checks use `tasks/scripts/check_review_readiness.py`. The `PR Issue Acceptance` workflow reports the native `OpenShell / PR Issue Acceptance` job result when a PR is opened, edited, reopened, or updated with new commits, including drafts. It only reports acceptance and does not change the PR. `Review Readiness` checks the same policy when a ready PR is opened or leaves draft; it moves rejected work to draft before requesting reviewers. Area/topic label changes only reconcile reviewers.
412+
413+
The checks do not publish a shared commit status; lookup and execution errors fail the job. Description references support `#NNN`, `OWNER/REPO#NNN`, and GitHub issue URLs. Rerun `PR Issue Acceptance` after issue labels change. Making the job required for merging and configuring any required Actions event policy are separate repository settings; merge-queue support is not included.
412414

413415
Automated dependency update PRs, including Dependabot PRs, are exempt from the separate issue and closing-reference requirement. Human-authored dependency updates follow the normal issue requirement. The exception does not bypass `PR Issue Acceptance` for authors without repository write access or change applicable verification, review, or private vulnerability disclosure requirements.
414416

‎tasks/scripts/check_issue_acceptance.cjs‎

Lines changed: 0 additions & 77 deletions
This file was deleted.

‎tasks/scripts/check_issue_acceptance.test.cjs‎

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)