Skip to content

Commit f8bbc48

Browse files
authored
Update star-reminder.yml
1 parent d7bb65f commit f8bbc48

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,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+
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+
}

0 commit comments

Comments
 (0)