Skip to content

Commit 988a1b0

Browse files
ci: thank a first-time contributor when their PR is merged
1 parent f64ab4f commit 988a1b0

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: First contribution
2+
3+
# Thanks someone the first time a PR of theirs is merged. On merge rather than on open:
4+
# at that point they've actually given something, so it reads as thanks instead of a pitch.
5+
#
6+
# pull_request_target is required to comment on a fork's PR — it runs with the base repo's
7+
# permissions. It therefore MUST NOT check out or execute the PR's code; this job only
8+
# posts a comment, and has no checkout step for that reason.
9+
on:
10+
pull_request_target:
11+
types: [closed]
12+
13+
permissions:
14+
pull-requests: write
15+
16+
jobs:
17+
thanks:
18+
if: >-
19+
github.event.pull_request.merged == true &&
20+
(github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' ||
21+
github.event.pull_request.author_association == 'FIRST_TIMER')
22+
runs-on: ubuntu-latest
23+
steps:
24+
- env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
PR: ${{ github.event.pull_request.number }}
27+
AUTHOR: ${{ github.event.pull_request.user.login }}
28+
run: |
29+
gh api --method POST "repos/${{ github.repository }}/issues/$PR/comments" -F body=@- <<EOF
30+
Merged — thanks @$AUTHOR, that's your first one here.
31+
32+
If the project turned out to be useful to you, a ⭐ genuinely helps: stacktale is
33+
new, and stars are most of what decides whether anyone else finds it.
34+
35+
Either way you're welcome back — the [\`good first issue\`](https://github.com/${{ github.repository }}/labels/good%20first%20issue)
36+
list is kept honest, and each one names the files to touch and how to verify.
37+
EOF

0 commit comments

Comments
 (0)