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
73 changes: 73 additions & 0 deletions .github/scripts/gfi_notify_team.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Script to notify the team when a GFI issue is labeled.

const marker = '<!-- GFI Issue Notification -->';
const TEAM_ALIAS = '@hiero-ledger/hiero-sdk-good-first-issue-support';

async function notifyTeam(github, owner, repo, issue, message, marker) {
const comment = `${marker} :wave: Hello Team :wave:
${TEAM_ALIAS}

${message}

Repository: ${owner}/${repo} : Issue: #${issue.number} - ${issue.title || '(no title)'}

Best Regards,
Python SDK team`;

try {
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: comment,
});
console.log(`Notified team about GFI issue #${issue.number}`);
return true;
} catch (commentErr) {
console.log(`Failed to notify team about GFI issue #${issue.number}:`, commentErr.message || commentErr);
return false;
}
}

module.exports = async ({ github, context }) => {
try {
const { owner, repo } = context.repo;
const { issue, label } = context.payload;

if (!issue?.number) return console.log('No issue in payload');

const labelName = label?.name;
if (!labelName) return;

let message = '';
if (labelName === 'Good First Issue') {
message = 'There is a new GFI in the Python SDK which is ready to be assigned';
} else if (labelName === 'Good First Issue Candidate') {
message = 'An issue in the Python SDK requires immediate attention to verify if it is a GFI and label it appropriately';
} else {
return;
}

// Check for existing comment
const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number: issue.number, per_page: 100
});
if (comments.some(c => c.body?.includes(marker))) {
return console.log(`Notification already exists for #${issue.number}`);
}

// Post notification
const success = await notifyTeam(github, owner, repo, issue, message, marker);

if (success) {
console.log('=== Summary ===');
console.log(`Repository: ${owner}/${repo}`);
console.log(`Issue Number: ${issue.number}`);
console.log(`Label: ${labelName}`);
console.log(`Message: ${message}`);
}

} catch (err) {
console.log('❌ Error:', err.message);
}
};
37 changes: 37 additions & 0 deletions .github/workflows/bot-gfi-notify-team.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow notifies the GFI support team when an issue is labeled as a GFI or GFI Candidate.
name: GFI Issue Notification
on:
issues:
types:
- labeled

permissions:
issues: write
contents: read

jobs:
gfi_notify_team:
runs-on: ubuntu-latest
if: >
(github.event_name == 'issues' && (
github.event.label.name == 'Good First Issue' ||
github.event.label.name == 'Good First Issue Candidate'
))

steps:
- name: Harden the runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1

- name: Notify team of GFI issues
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd #v8.0.0
with:
script: |
const script = require('./.github/scripts/gfi_notify_team.js');
await script({ github, context});
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
- Enhanced `.github/ISSUE_TEMPLATE/01_good_first_issue.yml` with welcoming message and acceptance criteria sections to guide contributors in creating quality GFIs (#1052)
- Add workflow to notify team about P0 issues `bot-p0-issues-notify-team.yml`
- 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)
- 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)

### Changed
- Improved consistency of transaction examples (#1120)
Expand Down