Skip to content

Commit a99c55a

Browse files
HarxhitShantKhatri
authored andcommitted
feat(workflow): add merged PR discord reminder for GSSoC labels (#409)
1 parent f8fa913 commit a99c55a

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = async ({ github, context }) => {
2+
const pr = context.payload.pull_request;
3+
const ignoreUsers = [
4+
'ShantKhatri',
5+
'Harxhit'
6+
]
7+
try {
8+
// Only continue if merged
9+
if (!pr || !pr.merged) {
10+
console.log('PR not merged.');
11+
return;
12+
}
13+
14+
const prNumber = pr.number;
15+
const contributor = pr.user.login;
16+
17+
if(ignoreUsers.includes(contributor)){
18+
console.log(`Ignoring PR #${prNumber} by ${contributor}`);
19+
return;
20+
}
21+
22+
await github.rest.issues.createComment({
23+
owner: context.repo.owner,
24+
repo: context.repo.repo,
25+
issue_number: prNumber,
26+
body: `Congratulations @${contributor} on getting PR #${prNumber} merged!
27+
28+
Thank you for your contribution. Please mention @Harxhit in our Discord server to receive the appropriate GSSoC labels and recognition.
29+
`
30+
});
31+
32+
console.log(`Comment added to PR #${prNumber}`);
33+
} catch (error) {
34+
console.error(error)
35+
}
36+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: GSSoC Discord Pin Reminder
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
workflow_dispatch:
7+
8+
jobs:
9+
discord-pin-reminder:
10+
if: github.event.pull_request.merged == true
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
pull-requests: write
15+
issues: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
21+
- name: Notify contributor about Discord GSSoC labels
22+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
script: |
26+
const script = require('./.github/scripts/discordPinReminder.js');
27+
await script({ github, context });

0 commit comments

Comments
 (0)