Skip to content

Commit

Permalink
Upgrade to Node20 and ignore issues when trying to unblock (#28)
Browse files Browse the repository at this point in the history
* ⬆️ Upgrade to Nodejs v20 from v16

Fixes #26

* Catch error if unblocking fails

---------

Co-authored-by: Eric Bouchut <[email protected]>
  • Loading branch information
Levi-Lesches and ebouchut authored Oct 27, 2024
1 parent 9fd381f commit 87d4122
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ branding:
icon: "git-pull-request"
color: "red"
runs:
using: 'node16'
using: 'node20'
main: 'src/index.js'
4 changes: 2 additions & 2 deletions src/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export async function rerunAction(issueNumber) {
for (const action of actionRuns) {
const actionTarget = action.pull_requests [0];
if (
action.name == "Blocking Issues"
&& actionTarget
action.name == "Blocking Issues"
&& actionTarget
&& actionTarget.number === issueNumber
) {
core.debug(` Rerunning action run id: ${action.id}`);
Expand Down
14 changes: 11 additions & 3 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,24 @@ export async function update(issue) {
if (otherIssue === null) brokenIssues.push(issueNumber);
else if (otherIssue.state === "open") openIssues.push(issueNumber);
}
if (openIssues.length > 0) core.debug(`These issues are still open: ${openIssues}`);
if (openIssues.length > 0) core.debug(`These issues are still open: ${openIssues}`);

core.info("Writing comment...");
const commentText = utils.getCommentText(blockingIssueNumbers, openIssues, brokenIssues);
await github.writeComment(issue.number, commentText);

core.info("Updating label...");
const isBlocked = openIssues.length > 0;
if (isBlocked) await github.applyLabel(issue.number, label.name);
else await github.removeLabel(issue.number, label.name);
core.info(`Is blocked? ${isBlocked}`);
if (isBlocked) {
await github.applyLabel(issue.number, label.name);
} else {
try {
await github.removeLabel(issue.number, label.name);
} catch {
// No action needed if issue is not already blocked.
}
}

return isBlocked;
}
Expand Down

0 comments on commit 87d4122

Please sign in to comment.