Skip to content

Commit 5a32d15

Browse files
committed
Updates flag issues js scripts for formatting and notification trigger
The post-to-agenda script will now create a new notification issue if the status issue is closed, in addition to if it is missing.
1 parent 7fba411 commit 5a32d15

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

github-actions/flag-issues-unlabeled-after-deletion/create-notification-issue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function createUnlabelNotificationIssue({
3131

3232
// Create the notification issue
3333
const notificationIssueNum = await createTemplatedIssue({
34-
title: `Review Needed - Label ${labelName} Deleted`,
34+
title: `Review Needed - Label \`${labelName}\` Deleted`,
3535
templatePath: path.resolve(
3636
__dirname,
3737
"./templates/notification-issue-body.md",

github-actions/flag-issues-unlabeled-after-deletion/post-to-agenda.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,22 @@ async function postUnlabelNotificationToAgenda({
3737
});
3838

3939
try {
40+
// Check the status of the agenda issue.
41+
const statusIssue = await github.rest.issues.get({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
issue_number: STATIC_ISSUE_NUMS.AGENDA});
45+
46+
// If not open, throw error to create a status closed notification issue
47+
if (statusIssue["data"]["state"] !== "open") {
48+
throw new Error("Status issue has state:" + statusIssue["data"]["state"]);
49+
}
50+
4051
// Post comment to agenda issue
4152
await postComment(STATIC_ISSUE_NUMS.AGENDA, agendaComment, github, context);
53+
4254
} catch (err) {
43-
// There was an issue posting to the agenda -- likely, the agenda is missing.
55+
// There was an issue posting to the agenda -- either the agenda is missing or is closed.
4456
// Create a notification issue about this error
4557
const timestamp = getLATimestamp();
4658
const missingAgendaIssueNum = await createTemplatedIssue({

0 commit comments

Comments
 (0)