From add9984a8ee82be14d14ea3171bf518c91bc07f2 Mon Sep 17 00:00:00 2001 From: Beanie <62057938+BeanieMen@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:52:04 +0000 Subject: [PATCH] fix: improvements --- index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.ts b/index.ts index eb651fba6..9c347cd96 100644 --- a/index.ts +++ b/index.ts @@ -88,8 +88,8 @@ async function main() { } continue; } - // If devpool issue has the "Unavailable" label then close such issue - if ((devpoolIssue.labels as GitHubLabel[]).some((label) => label.name.includes(LABELS.UNAVAILABLE))) { + // If project issue is assigned then close the devpool equivalent + if (projectIssue.assignee?.login) { if (devpoolIssue.state === "open") { await octokit.rest.issues.update({ owner: DEVPOOL_OWNER_NAME, @@ -110,9 +110,7 @@ async function main() { state: "open", }); console.log(`Opened (bounty available): ${devpoolIssue.html_url} (${projectIssue.html_url})`); - } else { - console.log(`Already opened (bounty available): ${devpoolIssue.html_url} (${projectIssue.html_url})`); - } + } else continue; } // prepare for issue updating const isDevpoolUnavailableLabel = (devpoolIssue.labels as GitHubLabel[])?.some((label) => label.name === LABELS.UNAVAILABLE); @@ -154,7 +152,7 @@ async function main() { if (projectIssue.state === "closed") continue; // if issue doesn't have the "Price" label then skip it, no need to pollute repo with draft issues if (!(projectIssue.labels as GitHubLabel[]).some((label) => label.name.includes(LABELS.PRICE))) continue; - if (projectIssue.assignee) continue; + if (projectIssue.assignee?.login) continue; // create a new issue const createdIssue = await octokit.rest.issues.create({