Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/scripts/discordPinReminder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = async ({ github, context }) => {
const pr = context.payload.pull_request;
const ignoreUsers = [
'ShantKhatri',
'Harxhit'
]
try {
// Only continue if merged
if (!pr || !pr.merged) {
console.log('PR not merged.');
return;
}

const prNumber = pr.number;
const contributor = pr.user.login;

if(ignoreUsers.includes(contributor)){
console.log(`Ignoring PR #${prNumber} by ${contributor}`);
return;
}

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `Congratulations @${contributor} on getting PR #${prNumber} merged!
Thank you for your contribution. Please mention @Harxhit in our Discord server to receive the appropriate GSSoC labels and recognition.
`
});

console.log(`Comment added to PR #${prNumber}`);
} catch (error) {
console.error(error)
}
};
27 changes: 27 additions & 0 deletions .github/workflows/gssoc-discord-pin-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: GSSoC Discord Pin Reminder

on:
pull_request:
types: [closed]
workflow_dispatch:

jobs:
discord-pin-reminder:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

permissions:
pull-requests: write
issues: write

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Notify contributor about Discord GSSoC labels
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require('./.github/scripts/discordPinReminder.js');
await script({ github, context });