Skip to content

chore: Add PR validation workflow#2918

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

chore: Add PR validation workflow#2918
stephanie-anderson merged 2 commits intomasterfrom
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>
@stephanie-anderson stephanie-anderson marked this pull request as ready for review March 27, 2026 14:54
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.

@stephanie-anderson stephanie-anderson enabled auto-merge (squash) March 27, 2026 15:15
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +262 to +265
if: |
always()
&& github.event.pull_request.draft == false
&& needs.validate-non-maintainer-pr.outputs.was-closed != 'true'
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 enforce-draft job incorrectly runs on valid PRs because the was-closed output from the preceding job is not set for valid code paths, causing the conditional check to always pass.
Severity: CRITICAL

Suggested Fix

The validate-non-maintainer-pr job should be modified to explicitly set the was-closed output to 'false' in all execution paths where the PR is deemed valid and is not closed. This ensures the enforce-draft job's conditional logic will evaluate correctly and only trigger for PRs that were not closed.

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#L262-L265

Potential issue: The `validate-non-maintainer-pr` job only sets its `was-closed` output
when it closes an invalid PR. For valid PRs from either maintainers or contributors, the
job exits early without setting this output. The output defaults to an empty string,
causing the conditional check `needs.validate-non-maintainer-pr.outputs.was-closed !=
'true'` in the `enforce-draft` job to evaluate to true. Consequently, the
`enforce-draft` job incorrectly runs on all valid, non-draft PRs, converting them to
drafts and posting misleading violation comments, which breaks the intended workflow for
both maintainers and contributors.

@stephanie-anderson stephanie-anderson merged commit 06b45a1 into master Mar 27, 2026
135 checks passed
@stephanie-anderson stephanie-anderson deleted the chore/add-validate-pr-workflow branch March 27, 2026 17:33
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