Skip to content

Commit 835aaa1

Browse files
committed
Add star reminder workflow for pull request contributors
1 parent 14221ce commit 835aaa1

File tree

2 files changed

+113
-6
lines changed

2 files changed

+113
-6
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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: Check star status and send reminder
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(`Checking star status for contributor: ${contributor}`);
25+
26+
// Use GraphQL to check if user starred the repo
27+
const query = `
28+
query($owner: String!, $repo: String!, $user: String!) {
29+
user(login: $user) {
30+
starredRepositories(first: 100, orderBy: {field: STARRED_AT, direction: DESC}) {
31+
nodes {
32+
nameWithOwner
33+
}
34+
pageInfo {
35+
hasNextPage
36+
}
37+
}
38+
}
39+
}
40+
`;
41+
42+
try {
43+
const result = await github.graphql(query, {
44+
owner: owner,
45+
repo: repo,
46+
user: contributor
47+
});
48+
49+
const repoFullName = `${owner}/${repo}`;
50+
const hasStarred = result.user.starredRepositories.nodes.some(
51+
starredRepo => starredRepo.nameWithOwner === repoFullName
52+
);
53+
54+
console.log(`Has ${contributor} starred ${repoFullName}? ${hasStarred}`);
55+
56+
if (!hasStarred) {
57+
// Check if we've already sent a reminder on this PR
58+
const comments = await github.rest.issues.listComments({
59+
owner: owner,
60+
repo: repo,
61+
issue_number: prNumber
62+
});
63+
64+
const existingReminder = comments.data.find(comment =>
65+
comment.user.type === 'Bot' &&
66+
comment.body.includes('awesome contributor! 🌟')
67+
);
68+
69+
if (!existingReminder) {
70+
const message = `Dear @${contributor}
71+
72+
awesome contributor! 🌟 We noticed you contributed to #DevDisplay but forgot to star the repo. It's like making an amazing sandwich and forgetting to take a bite!
73+
74+
I think our repo's feeling a little lonely without your ⭐️ Can you help us out? 🤗
75+
76+
> **Star the repo by clicking the ⭐ button at the top of this page!**`;
77+
78+
await github.rest.issues.createComment({
79+
owner: owner,
80+
repo: repo,
81+
issue_number: prNumber,
82+
body: message
83+
});
84+
85+
console.log(`✅ Sent star reminder to ${contributor}`);
86+
} else {
87+
console.log(`ℹ️ Star reminder already sent to ${contributor} on this PR`);
88+
}
89+
} else {
90+
console.log(`⭐ ${contributor} has already starred the repository - no reminder needed!`);
91+
}
92+
} catch (error) {
93+
console.log(`❌ Error checking star status: ${error.message}`);
94+
95+
// If we can't determine star status, we'll skip sending the reminder
96+
// to avoid spamming users who might have already starred
97+
console.log(`⚠️ Skipping reminder due to API error`);
98+
}

public/data/omku415.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55
"avatar": "https://github.com/omku415.png",
66
"portfolio": "https://github.com/omku415",
77
"skills": [
8-
"C++", "JavaScript", "React", "HTML", "CSS",
9-
"Node.js", "Express.js", "JWT",
10-
"MySQL", "MongoDB",
11-
"Git", "VS Code",
12-
"Netlify", "Render", "Railway"
8+
"C++",
9+
"JavaScript",
10+
"React",
11+
"HTML",
12+
"CSS",
13+
"Node.js",
14+
"Express.js",
15+
"JWT",
16+
"MySQL",
17+
"MongoDB",
18+
"Git",
19+
"VS Code",
20+
"Netlify",
21+
"Render",
22+
"Railway"
1323
],
1424
"social": {
1525
"GitHub": "https://github.com/omku415",
@@ -24,4 +34,3 @@
2434
"Unstop": "https://unstop.com/u/omkum8636"
2535
}
2636
}
27-

0 commit comments

Comments
 (0)