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