Skip to content

Commit af1acfe

Browse files
committed
added body type validation check
1 parent a602b56 commit af1acfe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ runs:
113113
// Store the result as an output for downstream steps
114114
core.setOutput('result', JSON.stringify(body));
115115
116+
// Validate that the returned body is a string
117+
if (typeof body !== 'string') {
118+
throw new TypeError(
119+
`Returned value from user script must be a string. Received type '${typeof body}'. ` +
120+
`Please return a string, or serialize your result using JSON.stringify.`
121+
);
122+
}
123+
116124
// Output to GITHUB_STEP_SUMMARY
117125
if (postTarget === 'both' || postTarget === 'github-step-summary') {
118126
const summaryPath = process.env.GITHUB_STEP_SUMMARY;

0 commit comments

Comments
 (0)