Skip to content

chore: Add PR validation workflow#2608

Merged
stephanie-anderson merged 2 commits intomainfrom
chore/add-validate-pr-workflow
Mar 27, 2026
Merged

chore: Add PR validation workflow#2608
stephanie-anderson merged 2 commits intomainfrom
chore/add-validate-pr-workflow

Conversation

@stephanie-anderson
Copy link
Copy Markdown
Contributor

Summary

  • Adds a validate-pr.yml workflow to automatically validate non-maintainer PRs
  • Checks that PRs reference a GitHub issue with prior discussion between the author and a maintainer
  • Closes PRs that don't meet contribution guidelines (no issue reference, no maintainer discussion, or issue assigned to someone else)
  • Enforces that all PRs start as drafts

Rollout of getsentry/sentry-python#4233 across all SDK repos.

Test plan

  • Verify workflow file is valid YAML
  • Confirm SDK_MAINTAINER_BOT_APP_ID var and SDK_MAINTAINER_BOT_PRIVATE_KEY secret are available to this repo
  • Test with a non-maintainer PR that has no issue reference (should be closed)
  • Test with a maintainer PR (should be skipped)

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Automatically validates non-maintainer PRs by checking:
- Issue reference exists in PR body
- Referenced issue has discussion between author and maintainer
- Referenced issue is not assigned to someone else

Also enforces that all PRs start as drafts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Internal Changes 🔧

Deps

  • Update CLI to v3.3.4 by github-actions in #2604
  • Update Java SDK to v8.37.1 by github-actions in #2605
  • Update Cocoa SDK to v9.8.0 by github-actions in #2596
  • Update Native SDK to v0.13.3 by github-actions in #2597
  • Update Java SDK to v8.36.0 by github-actions in #2591

Other

  • Add PR validation workflow by stephanie-anderson in #2608
  • Pin GitHub Actions to full-length commit SHAs by joshuarli in #2601

Other

  • Fix command injection vulnerability in iOS workflow by fix-it-felix-sentry in #2598

🤖 This preview updates automatically when you update the PR.

@stephanie-anderson stephanie-anderson marked this pull request as ready for review March 27, 2026 14:51
@stephanie-anderson stephanie-anderson enabled auto-merge (squash) March 27, 2026 15:14
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

for (const user of usersToCheck) {
if (user === prAuthor) continue;
if (await isMaintainer(repo.owner, repo.repo, user)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The cross-repo maintainer check validates against the PR's repository instead of the issue's repository, causing valid PRs to be incorrectly closed.
Severity: MEDIUM

Suggested Fix

Update the call to isMaintainer on line 204 to use the issue's repository context. The call should be changed from isMaintainer(repo.owner, repo.repo, user) to isMaintainer(ref.owner, ref.repo, user) to align the code with the documented intent.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/validate-pr.yml#L204

Potential issue: When a pull request references an issue from a different repository,
the GitHub workflow incorrectly checks for maintainer permissions on the pull request's
repository instead of the issue's repository. The code on line 204 calls
`isMaintainer(repo.owner, repo.repo, user)`, where `repo` is the PR's repository. This
contradicts the code comment on line 193, which states the check should be on "the
issue's repo". This will cause the workflow to incorrectly close valid PRs from
non-maintainers that reference cross-repo issues, even when a maintainer of the issue's
repository has participated in the discussion.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.


for (const user of usersToCheck) {
if (user === prAuthor) continue;
if (await isMaintainer(repo.owner, repo.repo, user)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment contradicts code: wrong repo checked for maintainer

Medium Severity

The comment on line 193 states maintainer access is checked "on the issue's repo," but the isMaintainer call on line 204 passes repo.owner, repo.repo (the PR's repo) instead of ref.owner, ref.repo (the issue's repo). For cross-repo references (e.g., an issue in getsentry/sentry referenced from a different SDK repo), this means a maintainer of the issue's repo who commented would not be recognized unless they also maintain the PR's repo, or vice versa. Either the comment is misleading or the code has the wrong arguments.

Additional Locations (1)
Fix in Cursor Fix in Web

@stephanie-anderson stephanie-anderson merged commit b6bb396 into main Mar 27, 2026
70 checks passed
@stephanie-anderson stephanie-anderson deleted the chore/add-validate-pr-workflow branch March 27, 2026 17:34
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