Skip to content

Commit

Permalink
Add Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Oct 30, 2024
1 parent c9aae05 commit bef15c9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,24 +18,24 @@ if (!fs.existsSync(new URL('issues/', import.meta.url))){
}

const issue: Static<typeof Issue> = {
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))))

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)
}
Expand Down

0 comments on commit bef15c9

Please sign in to comment.