Skip to content

Commit a48ef4f

Browse files
committed
set output result to rendored body
1 parent fbacec3 commit a48ef4f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ inputs:
4545
description: 'Optional GitHub REST API base URL for GitHub Enterprise'
4646
required: false
4747

48+
outputs:
49+
result:
50+
description: 'The return value of the script, stringified with JSON.stringify'
51+
value: ${{ steps.run-script.outputs.result }}
52+
4853
runs:
4954
using: 'composite'
5055
steps:
@@ -64,6 +69,7 @@ runs:
6469
EOF
6570
6671
- name: Run custom JavaScript and post results
72+
id: run-script
6773
uses: actions/github-script@v8
6874
with:
6975
github-token: ${{ inputs.github-token }}
@@ -103,6 +109,9 @@ runs:
103109
const body = await func(github, context, core, glob, io, exec, require);
104110
console.info('✅ Executed user script successfully.');
105111
112+
// Store the result as an output for downstream steps
113+
core.setOutput('result', JSON.stringify(body));
114+
106115
// Output to GITHUB_STEP_SUMMARY
107116
if (postTarget === 'both' || postTarget === 'github-step-summary') {
108117
const summaryPath = process.env.GITHUB_STEP_SUMMARY;
@@ -131,4 +140,5 @@ runs:
131140
}
132141
} catch (error) {
133142
console.error(`❌ Error processing ${{ inputs.label }} results:`, error);
143+
core.setOutput('result', JSON.stringify({ error: error.message }));
134144
}

0 commit comments

Comments
 (0)