Skip to content

Commit 7ebadc7

Browse files
committed
be nice, say hello
1 parent b7e120b commit 7ebadc7

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/welcome.yml

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

0 commit comments

Comments
 (0)