Skip to content

Commit d6ed70b

Browse files
committed
chore(repo): Add new contributing guidelines and auto-close outside PRs open in "ready to review" status
1 parent 440c16c commit d6ed70b

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Require Draft PR
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
require-draft:
12+
if: >
13+
github.event.pull_request.draft == false &&
14+
github.event.pull_request.author_association != 'MEMBER' &&
15+
github.event.pull_request.author_association != 'OWNER'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Close non-draft PR
19+
env:
20+
GH_TOKEN: ${{ github.token }}
21+
run: |
22+
gh pr close ${{ github.event.pull_request.number }} \
23+
--repo ${{ github.repository }} \
24+
--comment "Thanks for your contribution! We require all external PRs to be opened in **draft** status first so you can address CodeRabbit review comments and ensure CI passes before requesting a review. Please re-open this PR as a draft. See [CONTRIBUTING.md](https://github.com/${{ github.repository }}/blob/main/CONTRIBUTING.md#pr-workflow) for details."

CONTRIBUTING.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,23 @@ See the [Job Catalog](./references/job-catalog/README.md) file for more.
242242

243243
**If you get errors, be sure to fix them before committing.**
244244

245-
- Be sure to [check the "Allow edits from maintainers" option](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) while creating you PR.
246-
- If your PR refers to or fixes an issue, be sure to add `refs #XXX` or `fixes #XXX` to the PR description. Replacing `XXX` with the respective issue number. See more about [Linking a pull request to an issue
247-
](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
245+
> **Note:** We may close PRs if we decide that the cost of integrating the change outweighs the benefits. To improve the chances of your PR getting accepted, follow the guidelines below.
246+
247+
### PR workflow
248+
249+
1. **Always open your PR in draft status first.** Do not mark it as "Ready for Review" until the steps below are complete.
250+
2. **Address all CodeRabbit code review comments.** Our CI runs an automated code review via CodeRabbit. Go through each comment and either fix the issue or resolve it with a comment explaining why no change is needed.
251+
3. **Wait for all CI checks to pass.** Do not mark the PR as "Ready for Review" until every check is green.
252+
4. **Then mark the PR as "Ready for Review"** so a maintainer can take a look.
253+
254+
### Cost/benefit analysis for risky changes
255+
256+
If your change touches core infrastructure, modifies widely-used code paths, or could introduce regressions, consider doing a brief cost/benefit analysis and including it in the PR description. Explain what the benefit is to users and why the risk is worth it. This goes a long way toward helping maintainers evaluate your contribution.
257+
258+
### General guidelines
259+
260+
- Be sure to [check the "Allow edits from maintainers" option](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) while creating your PR.
261+
- If your PR refers to or fixes an issue, be sure to add `refs #XXX` or `fixes #XXX` to the PR description. Replacing `XXX` with the respective issue number. See more about [Linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
248262
- Be sure to fill the PR Template accordingly.
249263

250264
## Adding changesets

0 commit comments

Comments
 (0)