Skip to content

Commit 4bebe0b

Browse files
committed
refactor(ci/cd): update P0 bot to use priority: critical label
Signed-off-by: tannaya7 <tannayasupriya157@gmail.com>
1 parent 245133d commit 4bebe0b

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

.github/scripts/bot-p0-issues-notify-team.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
// Script to notify the team when a P0 issue is created.
22

3+
const CRITICAL_LABEL = 'priority: critical';
34
const 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)'}
1011
Please prioritize this issue accordingly.
1112
1213
Best Regards,
1314
Automated 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

3031
module.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 ===');

.github/workflows/bot-p0-issues-notify-team.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow warns the team about P0 issues immediately when they are created.
1+
# This workflow warns the team about priority: critical issues immediately when they are created.
22
name: P0 Issue Alert
33
on:
44
issues:
@@ -12,10 +12,10 @@ permissions:
1212
jobs:
1313
p0_notify_team:
1414
runs-on: hl-sdk-py-lin-md
15-
# Only run for issues labeled with 'p0' (case-insensitive)
15+
# Only run for issues labeled with 'priority: critical' (case-insensitive)
1616
if: >
1717
(github.event_name == 'issues' && (
18-
(github.event.label.name == 'p0' || github.event.label.name == 'P0'))
18+
(github.event.label.name == 'priority: critical' || github.event.label.name == 'Priority: Critical'))
1919
)
2020
2121
steps:
@@ -34,4 +34,4 @@ jobs:
3434
with:
3535
script: |
3636
const script = require('./.github/scripts/bot-p0-issues-notify-team.js');
37-
await script({ github, context});
37+
await script({ github, context });

0 commit comments

Comments
 (0)