11// Script to notify the team when a P0 issue is created.
22
3+ const CRITICAL_LABEL = 'priority: critical' ;
34const marker = '<!-- P0 Issue Notification -->' ;
45
5- async function notifyTeam ( github , owner , repo , issue , marker ) {
6- const comment = `${ marker } :rotating_light: Attention Team :rotating_light:
6+ async function notifyTeam ( github , owner , repo , issue , marker ) {
7+ const comment = `${ marker } :rotating_light: Attention Team :rotating_light:
78@hiero-ledger/hiero-sdk-python-maintainers @hiero-ledger/hiero-sdk-python-committers @hiero-ledger/hiero-sdk-python-triage
89
9- A new P0 issue has been created: #${ issue . number } - ${ issue . title || '(no title)' }
10+ A new critical priority issue has been created: #${ issue . number } - ${ issue . title || '(no title)' }
1011Please prioritize this issue accordingly.
1112
1213Best Regards,
1314Automated Notification System` ;
1415
15- try {
16- await github . rest . issues . createComment ( {
17- owner,
18- repo,
19- issue_number : issue . number ,
20- body : comment ,
21- } ) ;
22- console . log ( `Notified team about P0 issue #${ issue . number } ` ) ;
23- return true ;
24- } catch ( commentErr ) {
25- console . log ( `Failed to notify team about P0 issue #${ issue . number } :` , commentErr . message || commentErr ) ;
26- return false ;
27- }
16+ try {
17+ await github . rest . issues . createComment ( {
18+ owner,
19+ repo,
20+ issue_number : issue . number ,
21+ body : comment ,
22+ } ) ;
23+ console . log ( `Notified team about priority: critical issue #${ issue . number } ` ) ;
24+ return true ;
25+ } catch ( commentErr ) {
26+ console . log ( `Failed to notify team about priority: critical issue #${ issue . number } :` , commentErr . message || commentErr ) ;
27+ return false ;
2828 }
29+ }
2930
3031module . exports = async ( { github, context } ) => {
3132 try {
@@ -34,8 +35,8 @@ module.exports = async ({ github, context }) => {
3435
3536 // Validations
3637 if ( ! issue ?. number ) return console . log ( 'No issue in payload' ) ;
37- if ( label ?. name ?. toLowerCase ( ) !== 'p0' ) return ;
38- if ( ! issue . labels ?. some ( l => l ?. name ?. toLowerCase ( ) === 'p0' ) ) return ;
38+ if ( label ?. name ?. toLowerCase ( ) !== CRITICAL_LABEL . toLowerCase ( ) ) return ;
39+ if ( ! issue . labels ?. some ( ( l ) => l ?. name ?. toLowerCase ( ) === CRITICAL_LABEL . toLowerCase ( ) ) ) return ;
3940
4041 // Check for existing comment
4142 const comments = await github . paginate ( github . rest . issues . listComments , {
@@ -44,7 +45,7 @@ module.exports = async ({ github, context }) => {
4445 if ( comments . some ( c => c . body ?. includes ( marker ) ) ) {
4546 return console . log ( `Notification already exists for #${ issue . number } ` ) ;
4647 }
47- // Post notification
48+ // Post notification
4849 await notifyTeam ( github , owner , repo , issue , marker ) ;
4950
5051 console . log ( '=== Summary ===' ) ;
0 commit comments