Skip to content

Commit 4243265

Browse files
fix(validate-pr): Address review feedback (#154)
- Paginate comment listing in enforce-draft.js to handle PRs with 30+ comments - Add null check on comment user property for deleted/suspended accounts - Clarify in README that maintainers are only exempt from issue validation, not draft enforcement Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9616b0e commit 4243265

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

validate-pr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Validates non-maintainer pull requests against contribution guidelines.
77
1. **Validates issue references** — Non-maintainer PRs must reference a GitHub issue where the PR author and a maintainer have discussed the approach. PRs that don't meet this requirement are automatically closed with a descriptive comment.
88
2. **Enforces draft status** — All PRs must start as drafts. Non-draft PRs are automatically converted and labeled.
99

10-
Maintainers (users with `admin` or `maintain` role) are exempt from all checks.
10+
Maintainers (users with `admin` or `maintain` role) are exempt from the issue reference validation. Draft enforcement applies to everyone.
1111

1212
## Usage
1313

validate-pr/scripts/enforce-draft.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ module.exports = async ({ github, context, core }) => {
2020
});
2121

2222
// Check for existing bot comment to avoid duplicates on reopen
23-
const comments = await github.rest.issues.listComments({
23+
const comments = await github.paginate(github.rest.issues.listComments, {
2424
...repo,
2525
issue_number: pullRequest.number,
26+
per_page: 100,
2627
});
27-
const botComment = comments.data.find(c =>
28-
c.user.type === 'Bot' &&
28+
const botComment = comments.find(c =>
29+
c.user?.type === 'Bot' &&
2930
c.body.includes('automatically converted to draft')
3031
);
3132
if (botComment) {

0 commit comments

Comments
 (0)