Skip to content

Commit 6d0e04b

Browse files
committed
meta: remind first-time contributors to focus on one PR
Add a reminder to the welcome comment when a first-time contributor has other open PRs, listing those PRs to reduce repeated manual reminders. Use the template provided by MikeMcC399. Refs: nodejs#67199 Assisted-by: Codex Signed-off-by: inoway46 <[email protected]>
1 parent 8337f97 commit 6d0e04b

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎.github/workflows/contributor-guidance.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ jobs:
7070
contents: read
7171
pull-requests: write
7272
steps:
73+
- name: Find other open pull requests
74+
id: other-prs
75+
if: needs.contributor.outputs.is_first_time == 'true'
76+
# Still post the welcome if this advisory lookup fails.
77+
continue-on-error: true
78+
shell: bash
79+
env:
80+
GH_TOKEN: ${{ github.token }}
81+
AUTHOR_ID: ${{ github.event.pull_request.user.id }}
82+
NUMBER: ${{ github.event.pull_request.number }}
83+
run: |
84+
# List PRs directly to avoid search-index delays after creation.
85+
pull_requests=$(gh api --paginate --slurp \
86+
"/repos/$GITHUB_REPOSITORY/pulls?state=open&per_page=100" |
87+
jq -r --argjson author "$AUTHOR_ID" --argjson number "$NUMBER" \
88+
'[.[][] | select(.user.id == $author and .number != $number)] |
89+
sort_by(.number) | map("#\(.number)") | join(", ")')
90+
echo "pull_requests=$pull_requests" >> "$GITHUB_OUTPUT"
91+
7392
- name: Scan contributor activity
7493
id: agentscan
7594
# The welcome should still be posted if this advisory scan fails.
@@ -98,6 +117,7 @@ jobs:
98117
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99118
IS_FIRST_TIME: ${{ needs.contributor.outputs.is_first_time }}
100119
NUMBER: ${{ github.event.pull_request.number }}
120+
OTHER_OPEN_PRS: ${{ steps.other-prs.outputs.pull_requests }}
101121
WELCOME_MESSAGE: >2-
102122
Welcome to Node.js, and thank you for your first contribution!
103123
@@ -114,6 +134,16 @@ jobs:
114134
For a first pull request, GitHub Actions require collaborator
115135
approval and Jenkins CI must be started by a collaborator or triager,
116136
so an initial wait is normal.
137+
MULTIPLE_PRS_MESSAGE: |-
138+
The recommendations in:
139+
140+
* [Guides and FAQs for first-time contributors](https://github.com/nodejs/node/blob/HEAD/doc/contributing/first-contributions.md)
141+
142+
advise you should tackle only one issue at a time and that you should not open any new PRs until your first PR has been approved.
143+
144+
Until the first PR has been approved and has landed in the `main` branch, GitHub classifies you as "first-time contributor". Each PR commit you push needs to be individually approved by team members to run in GitHub Actions CI. This causes delays for you as a contributor, and it adds to the work load for the team.
145+
146+
Waiting until the first PR has landed ensures that you as a contributor have experienced the complete process from PR submission to successful landing. After this has been completed, any new PRs or new commits to an existing PR are treated to rules for regular Contributors. GitHub Actions CI workflows are then run automatically without intervention by a team member.
117147
CAUTION_MESSAGE: >-
118148
> [!CAUTION]
119149
@@ -129,6 +159,10 @@ jobs:
129159
[automation policy](https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md#automation-and-bots)
130160
for additional context.
131161
run: |
162+
if [[ "$IS_FIRST_TIME" == "true" && -n "$OTHER_OPEN_PRS" ]]; then
163+
WELCOME_MESSAGE+=$'\n\n'"$MULTIPLE_PRS_MESSAGE"$'\n\n'"Other open PRs: $OTHER_OPEN_PRS"
164+
fi
165+
132166
if [[ "$IS_FIRST_TIME" == "true" && "$ADD_CAUTION" == "true" ]]; then
133167
body="$WELCOME_MESSAGE"$'\n\n'"$CAUTION_MESSAGE"
134168
elif [[ "$IS_FIRST_TIME" == "true" ]]; then

0 commit comments

Comments
 (0)