Skip to content

Commit 5956b97

Browse files
committed
be nice, say hello
1 parent ecfbd42 commit 5956b97

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/welcome.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Welcome new contributors
2+
3+
# This workflow has write permissions on the repo
4+
# It must not checkout a PR and run untrusted code
5+
6+
# Also requesting write permissions on PR to be able to comment
7+
permissions:
8+
pull-requests: 'write'
9+
10+
on: pull_request_target
11+
12+
jobs:
13+
welcome:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/github-script@v6
17+
with:
18+
script: |
19+
// Get a list of all issues created by the PR opener
20+
// See: https://octokit.github.io/rest.js/#pagination
21+
const creator = context.payload.sender.login
22+
const opts = github.rest.issues.listForRepo.endpoint.merge({
23+
...context.issue,
24+
creator,
25+
state: 'all'
26+
})
27+
const issues = await github.paginate(opts)
28+
29+
for (const issue of issues) {
30+
if (issue.number === context.issue.number) {
31+
continue
32+
}
33+
34+
if (issue.pull_request) {
35+
return // Creator is already a contributor.
36+
}
37+
}
38+
39+
await github.rest.issues.createComment({
40+
issue_number: context.issue.number,
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
body: `**Welcome**, new contributor!
44+
45+
Please make sure you're read our [contributing guide](CONTRIBUTING.md) and we look forward to reviewing your Pull request shortly ✨`
46+
})

0 commit comments

Comments
 (0)