File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,16 @@ jobs:
6262 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6363 with :
6464 script : |
65- const validationResultJson = `${{ steps.validate.outputs.validation_result }}`;
65+ // Use toJSON() to safely escape the JSON string for JavaScript interpolation
66+ // toJSON() will JSON-encode the string, so we need to parse it once to get the original JSON string,
67+ // then parse again to get the actual object
68+ const validationResultJsonString = ${{ toJSON(steps.validate.outputs.validation_result) }};
6669 let validationResult;
6770 try {
68- validationResult = JSON.parse(validationResultJson);
71+ // First parse: convert from JSON-encoded string to original JSON string
72+ const jsonString = JSON.parse(validationResultJsonString);
73+ // Second parse: convert from JSON string to object
74+ validationResult = JSON.parse(jsonString);
6975 } catch (e) {
7076 console.error('Failed to parse validation result:', e);
7177 return;
You can’t perform that action at this time.
0 commit comments