File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
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
+ })
You can’t perform that action at this time.
0 commit comments