Skip to content

Commit 7aefb94

Browse files
committed
fix: correct JSON parsing in PR metadata sync workflow
1 parent 3bcfbd8 commit 7aefb94

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/autolabel-pr-issue.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ jobs:
5353
github-token: ${{ secrets.GITHUB_TOKEN }}
5454
script: |
5555
// Safely parse outputs
56-
const issuesOutput = ${{ steps.extract-issues.outputs.issues }} || '[]';
57-
const issueNumbers = JSON.parse(issuesOutput);
58-
const prNumber = parseInt(${{ steps.extract-issues.outputs.pr }});
56+
const issuesOutput = '${{ steps.extract-issues.outputs.issues }}' || '[]';
57+
let issueNumbers;
58+
try {
59+
issueNumbers = JSON.parse(issuesOutput);
60+
} catch (err) {
61+
console.error('Failed to parse issues output:', issuesOutput);
62+
issueNumbers = [];
63+
}
64+
const prNumber = parseInt('${{ steps.extract-issues.outputs.pr }}');
65+
5966

6067
if (issueNumbers.length === 0) {
6168
console.log("No linked issues found");

0 commit comments

Comments
 (0)