Skip to content

Commit ebec9a2

Browse files
kplnosmn94-droidprajeeta15
authored andcommitted
feat: Add workflow to notify team about Good first issues (hiero-ledger#1123)
Signed-off-by: Osman Kaplan <kplnosmn94@gmail.com> Signed-off-by: prajeeta pal <prajeetapal@gmail.com>
1 parent 55c27b1 commit ebec9a2

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

.github/scripts/gfi_notify_team.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Script to notify the team when a GFI issue is labeled.
2+
3+
const marker = '<!-- GFI Issue Notification -->';
4+
const TEAM_ALIAS = '@hiero-ledger/hiero-sdk-good-first-issue-support';
5+
6+
async function notifyTeam(github, owner, repo, issue, message, marker) {
7+
const comment = `${marker} :wave: Hello Team :wave:
8+
${TEAM_ALIAS}
9+
10+
${message}
11+
12+
Repository: ${owner}/${repo} : Issue: #${issue.number} - ${issue.title || '(no title)'}
13+
14+
Best Regards,
15+
Python SDK team`;
16+
17+
try {
18+
await github.rest.issues.createComment({
19+
owner,
20+
repo,
21+
issue_number: issue.number,
22+
body: comment,
23+
});
24+
console.log(`Notified team about GFI issue #${issue.number}`);
25+
return true;
26+
} catch (commentErr) {
27+
console.log(`Failed to notify team about GFI issue #${issue.number}:`, commentErr.message || commentErr);
28+
return false;
29+
}
30+
}
31+
32+
module.exports = async ({ github, context }) => {
33+
try {
34+
const { owner, repo } = context.repo;
35+
const { issue, label } = context.payload;
36+
37+
if (!issue?.number) return console.log('No issue in payload');
38+
39+
const labelName = label?.name;
40+
if (!labelName) return;
41+
42+
let message = '';
43+
if (labelName === 'Good First Issue') {
44+
message = 'There is a new GFI in the Python SDK which is ready to be assigned';
45+
} else if (labelName === 'Good First Issue Candidate') {
46+
message = 'An issue in the Python SDK requires immediate attention to verify if it is a GFI and label it appropriately';
47+
} else {
48+
return;
49+
}
50+
51+
// Check for existing comment
52+
const comments = await github.paginate(github.rest.issues.listComments, {
53+
owner, repo, issue_number: issue.number, per_page: 100
54+
});
55+
if (comments.some(c => c.body?.includes(marker))) {
56+
return console.log(`Notification already exists for #${issue.number}`);
57+
}
58+
59+
// Post notification
60+
const success = await notifyTeam(github, owner, repo, issue, message, marker);
61+
62+
if (success) {
63+
console.log('=== Summary ===');
64+
console.log(`Repository: ${owner}/${repo}`);
65+
console.log(`Issue Number: ${issue.number}`);
66+
console.log(`Label: ${labelName}`);
67+
console.log(`Message: ${message}`);
68+
}
69+
70+
} catch (err) {
71+
console.log('❌ Error:', err.message);
72+
}
73+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This workflow notifies the GFI support team when an issue is labeled as a GFI or GFI Candidate.
2+
name: GFI Issue Notification
3+
on:
4+
issues:
5+
types:
6+
- labeled
7+
8+
permissions:
9+
issues: write
10+
contents: read
11+
12+
jobs:
13+
gfi_notify_team:
14+
runs-on: ubuntu-latest
15+
if: >
16+
(github.event_name == 'issues' && (
17+
github.event.label.name == 'Good First Issue' ||
18+
github.event.label.name == 'Good First Issue Candidate'
19+
))
20+
21+
steps:
22+
- name: Harden the runner
23+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
24+
with:
25+
egress-policy: audit
26+
27+
- name: Checkout repository
28+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
29+
30+
- name: Notify team of GFI issues
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd #v8.0.0
34+
with:
35+
script: |
36+
const script = require('./.github/scripts/gfi_notify_team.js');
37+
await script({ github, context});

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
4444
- Added new `.github/ISSUE_TEMPLATE/04_good_first_issue_candidate.yml` file (1068)(https://github.com/hiero-ledger/hiero-sdk-python/issues/1068)
4545
- Enhanced `.github/ISSUE_TEMPLATE/01_good_first_issue.yml` with welcoming message and acceptance criteria sections to guide contributors in creating quality GFIs (#1052)
4646
- Add workflow to notify team about P0 issues `bot-p0-issues-notify-team.yml`
47+
- Added Issue Reminder (no-PR) bot, .github/scripts/issue_reminder_no_pr.sh and .github/workflows/bot-issue-reminder-no-pr.yml to automatically detect assigned issues with no linked pull requests for 7+ days and post a gentle ReminderBot comment.(#951)
48+
- Add a workflow to notify the team when issues are labeled as “good first issues” or identified as candidates for that label: `bot-gfi-notify-team.yml`(#1115)
4749

4850
### Changed
4951
- Improved consistency of transaction examples (#1120)

0 commit comments

Comments
 (0)