Skip to content

Commit

Permalink
store the unmerged_prs value as a json string with array of PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
timpuida committed Nov 12, 2024
1 parent 8882d68 commit 95b76e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
description: Token for the GitHub API.
default: ${{ github.token }}
outputs:
unmerged_pr:
unmerged_prs:
description: The PR that could not be merged automatically.
runs:
using: node20
Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ const handleUnupdatablePullRequest = async (
info(`Commented: ${newComment.html_url}`);
} catch (error: unknown) {
const { owner, repo } = context.repo;
setOutput("unmerged_pr", `/${owner}/${repo}/issues/${number}`);
let unmergedPrsJSON = getInput("unmerged_prs");
let unmergedPrs: string[];
try {
unmergedPrs = JSON.parse(unmergedPrsJSON);
} catch {
unmergedPrs = [];
}
unmergedPrs.push(`/${owner}/${repo}/issues/${number}`);
setOutput("unmerged_prs", JSON.stringify(unmergedPrs));
warning(ensureError(error));
}
};
Expand Down

0 comments on commit 95b76e0

Please sign in to comment.