From bef15c958917b889c68d8167179854f01cca1102 Mon Sep 17 00:00:00 2001 From: ingalls Date: Wed, 30 Oct 2024 09:14:54 -0600 Subject: [PATCH] Add Issue --- actions.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/actions.ts b/actions.ts index 4de7ede..83f1290 100644 --- a/actions.ts +++ b/actions.ts @@ -4,11 +4,11 @@ import { Issue, Health } from './src/types.js'; if (!process.env.GITHUB_ISSUE) throw new Error('GITHUB_ISSUE Env Var must be set') -const issue = JSON.parse(process.env.GITHUB_ISSUE) +const ghissue = JSON.parse(process.env.GITHUB_ISSUE) let health = Health.GREEN; -const labels = issue.labels.map((label) => { return label.description }); +const labels = ghissue.labels.map((label) => { return label.description }); if (labels.includes('red')) health = Health.RED; if (labels.includes('yellow')) health = Health.YELLOW; @@ -18,16 +18,16 @@ if (!fs.existsSync(new URL('issues/', import.meta.url))){ } const issue: Static = { - id: issue.number, - username: issue.user.login, + id: ghissue.number, + username: ghissue.user.login, health, - start: issue.created_at, - end: issue.closed_at || undefined, - title: issue.title, - body: issue.body + start: ghissue.created_at, + end: ghissue.closed_at || undefined, + title: ghissue.title, + body: ghissue.body } -fs.writeFileSync(new URL(`issues/${issue.number}.json`, import.meta.url), JSON.stringify(issue, null, 4)); +fs.writeFileSync(new URL(`issues/${issue.id}.json`, import.meta.url), JSON.stringify(issue, null, 4)); const config = JSON.parse(String(fs.readFileSync(new URL(`./config.json`, import.meta.url)))) @@ -35,7 +35,7 @@ for (const service of services) { if (labels.includes(service.id)) { // Handle Label being added to issue service.issues.push(issue.id) - } else if (service.issues.includes(issue.id) { + } else if (service.issues.includes(issue.id)) { // Handle Label being removed from issue service.issues.splice(service.issues.indexOf(issue.id), 1) }