File tree Expand file tree Collapse file tree 1 file changed +24
-11
lines changed Expand file tree Collapse file tree 1 file changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -3,23 +3,36 @@ name: Comment on PR
33on : pull_request
44
55jobs :
6- diff :
6+ welcome :
77 runs-on : ubuntu-latest
88 steps :
99 - uses : actions/github-script@v3
1010 with :
1111 github-token : ${{secrets.GITHUB_TOKEN}}
1212 script : |
13- context.pulls.createReview({
14- pull_number: 14,
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.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.issues.createComment({
34+ issue_number: context.issue.number,
1535 owner: context.repo.owner,
1636 repo: context.repo.repo,
17- body: 'thanks'
18- event: 'REQUEST_CHANGES'
19- comments: [
20- {
21- path: gitlab/workflows/comment_pr.yml,
22- line: 1,
23- body: 'thanks'
24- }
37+ body: 'Welcome, new contributor!'
2538 })
You can’t perform that action at this time.
0 commit comments