|
1 | | -name: Star Reminder for Contributors |
2 | | - |
3 | | -on: |
4 | | - pull_request: |
5 | | - types: [opened] |
6 | | - |
7 | | -jobs: |
8 | | - star-reminder: |
9 | | - runs-on: ubuntu-latest |
10 | | - permissions: |
11 | | - pull-requests: write |
12 | | - contents: read |
13 | | - |
14 | | - steps: |
15 | | - - name: Send star reminder to new contributors |
16 | | - uses: actions/github-script@v7 |
17 | | - with: |
18 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
19 | | - script: | |
20 | | - const { owner, repo } = context.repo; |
21 | | - const contributor = context.payload.pull_request.user.login; |
22 | | - const prNumber = context.payload.pull_request.number; |
23 | | - |
24 | | - console.log('Processing PR from contributor: ' + contributor); |
25 | | - |
26 | | - // Check if we've already sent a reminder on this PR |
27 | | - const comments = await github.rest.issues.listComments({ |
28 | | - owner: owner, |
29 | | - repo: repo, |
30 | | - issue_number: prNumber |
31 | | - }); |
32 | | - |
33 | | - const existingReminder = comments.data.find(comment => |
34 | | - comment.user.type === 'Bot' && |
35 | | - comment.body.includes('awesome contributor!') |
36 | | - ); |
37 | | - |
38 | | - if (!existingReminder) { |
39 | | - const message = 'Dear @' + contributor + '\n\n' + |
40 | | - 'awesome contributor! We noticed you contributed to DevDisplay but forgot to star the repo. Its like making an amazing sandwich and forgetting to take a bite!\n\n' + |
41 | | - 'I think our repos feeling a little lonely without your star. Can you help us out?\n\n' + |
42 | | - '> **Star the repo by clicking the star button at the top of this page!**'; |
43 | | -
|
44 | | - await github.rest.issues.createComment({ |
45 | | - owner: owner, |
46 | | - repo: repo, |
47 | | - issue_number: prNumber, |
48 | | - body: message |
49 | | - }); |
50 | | - |
51 | | - console.log('Sent star reminder to ' + contributor); |
52 | | - } else { |
53 | | - console.log('Star reminder already sent to ' + contributor + ' on this PR'); |
54 | | - } |
| 1 | +name: Star Reminder for Contributors |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened] |
| 6 | + |
| 7 | +jobs: |
| 8 | + star-reminder: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + issues: write |
| 12 | + pull-requests: write |
| 13 | + contents: read |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Send star reminder to new contributors |
| 17 | + uses: actions/github-script@v7 |
| 18 | + with: |
| 19 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + script: | |
| 21 | + const { owner, repo } = context.repo; |
| 22 | + const contributor = context.payload.pull_request.user.login; |
| 23 | + const prNumber = context.payload.pull_request.number; |
| 24 | +
|
| 25 | + console.log('Processing PR from contributor: ' + contributor); |
| 26 | +
|
| 27 | + // Check if we've already sent a reminder on this PR |
| 28 | + const comments = await github.rest.issues.listComments({ |
| 29 | + owner: owner, |
| 30 | + repo: repo, |
| 31 | + issue_number: prNumber |
| 32 | + }); |
| 33 | +
|
| 34 | + const existingReminder = comments.data.find(comment => |
| 35 | + comment.user.type === 'Bot' && |
| 36 | + comment.body.includes('awesome contributor!') |
| 37 | + ); |
| 38 | +
|
| 39 | + if (!existingReminder) { |
| 40 | + const message = 'Dear @' + contributor + '\n\n' + |
| 41 | + 'awesome contributor! We noticed you contributed to DevDisplay but forgot to star the repo. Its like making an amazing sandwich and forgetting to take a bite!\n\n' + |
| 42 | + 'I think our repos feeling a little lonely without your star. Can you help us out?\n\n' + |
| 43 | + '> **Star the repo by clicking the star button at the top of this page!**'; |
| 44 | +
|
| 45 | + await github.rest.issues.createComment({ |
| 46 | + owner: owner, |
| 47 | + repo: repo, |
| 48 | + issue_number: prNumber, |
| 49 | + body: message |
| 50 | + }); |
| 51 | + |
| 52 | + console.log('Sent star reminder to ' + contributor); |
| 53 | + } else { |
| 54 | + console.log('Star reminder already sent to ' + contributor + ' on this PR'); |
| 55 | + } |
0 commit comments