Skip to content

ci+docs: Add draft PR enforcement#5867

Merged
stephanie-anderson merged 3 commits intomasterfrom
sanderson/enforce-draft-pr
Mar 25, 2026
Merged

ci+docs: Add draft PR enforcement#5867
stephanie-anderson merged 3 commits intomasterfrom
sanderson/enforce-draft-pr

Conversation

@stephanie-anderson
Copy link
Contributor

Add a GitHub Actions workflow that automatically converts non-draft PRs to draft on open/reopen, and document the draft PR requirement in CONTRIBUTING.md.

Motivation: Our code submission standard says PRs must start as drafts, but this wasn't enforced. Non-draft PRs trigger review notifications prematurely and signal readiness when the author may not be done. This workflow nudges contributors to open as draft by automatically converting non-draft PRs and posting a comment explaining the policy.

What's included:

  • .github/workflows/enforce-draft-pr.yml — triggers on pull_request_target (opened, reopened), uses the GraphQL convertPullRequestToDraft mutation. Includes error handling and comment deduplication on reopen.
  • CONTRIBUTING.md — new "Pull Requests" section documenting the draft requirement and linking to the code submission standard.

Limitations: GitHub has no pre-creation hook, so the initial CI run and review notifications still fire before the conversion. The value is in training contributors and ensuring draft state before a maintainer picks up the PR.

No exemptions — applies to everyone (maintainers, internal, external contributors).

Add workflow to auto-convert non-draft PRs to draft on open/reopen.
Add Pull Requests section to CONTRIBUTING.md documenting the draft
requirement and linking to the code submission standard.

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

github-actions bot commented Mar 25, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

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


New Features ✨

Langchain

  • Set gen_ai.operation.name and gen_ai.pipeline.name on LLM spans by ericapisani in #5849
  • Broaden AI provider detection beyond OpenAI and Anthropic by ericapisani in #5707
  • Update LLM span operation to gen_ai.generate_text by ericapisani in #5796

Internal Changes 🔧

Langchain

  • Add text completion test by alexander-alderman-webb in #5740
  • Add tool execution test by alexander-alderman-webb in #5739
  • Add basic agent test with Responses call by alexander-alderman-webb in #5726
  • Replace mocks with httpx types by alexander-alderman-webb in #5724
  • Consolidate span origin assertion by alexander-alderman-webb in #5723
  • Consolidate available tools assertion by alexander-alderman-webb in #5721

Other

  • Temporarily stop running litellm tests by alexander-alderman-webb in #5851

Other

  • ci+docs: Add draft PR enforcement by stephanie-anderson in #5867

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 9.08s

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 14386 uncovered lines.


Generated by Codecov Action

stephanie-anderson and others added 2 commits March 25, 2026 15:02
Co-authored-by: sentry-warden[bot] <258096371+sentry-warden[bot]@users.noreply.github.com>
Adds a label to PRs that were auto-converted to draft, enabling
maintainers to filter and track how often the rule is violated.

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 25, 2026 14:55
@stephanie-anderson stephanie-anderson requested a review from a team as a code owner March 25, 2026 14:55
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment on lines +42 to +46
await github.rest.issues.addLabels({
...repo,
issue_number: pullRequest.number,
labels: ['converted-to-draft'],
});
Copy link

Choose a reason for hiding this comment

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

Bug: The addLabels call lacks error handling. If it fails, the workflow will terminate silently without posting its explanatory comment.
Severity: MEDIUM

Suggested Fix

Wrap the addLabels call in a try/catch block to handle potential errors gracefully. This ensures that the script can continue execution or log a meaningful error, preventing a silent failure. Consider also programmatically ensuring the label exists or documenting it as a prerequisite.

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/enforce-draft-pr.yml#L42-L46

Potential issue: The call to `github.rest.issues.addLabels` is not wrapped in any error
handling. If this operation fails, for example, due to the `"converted-to-draft"` label
not existing in the repository or because of insufficient permissions (potentially
requiring `issues: write`), the script will terminate prematurely. This silent failure
would prevent the subsequent, explanatory comment from being posted to the pull request,
undermining the workflow's goal of educating the contributor about the draft conversion.

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

@stephanie-anderson stephanie-anderson merged commit 520ae5c into master Mar 25, 2026
158 checks passed
@stephanie-anderson stephanie-anderson deleted the sanderson/enforce-draft-pr branch March 25, 2026 15:12
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