Update output display to job summary (#3914)

* Update output display to job summary

* fix: handled exit-code of script

* added changelog message
This commit is contained in:
Cristiano Salerno 2023-10-06 19:41:36 +02:00 committed by GitHub
parent 3a2d76c7bc
commit 3457ec48af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -48,6 +48,8 @@
<!-- For example, Docker, GitHub Actions, pre-commit, editors --> <!-- For example, Docker, GitHub Actions, pre-commit, editors -->
- The action output displayed in the job summary is now wrapped in Markdown (#3914)
### Documentation ### Documentation
<!-- Major changes to documentation and policies. Small docs changes <!-- Major changes to documentation and policies. Small docs changes

View File

@ -36,10 +36,24 @@ runs:
- name: black - name: black
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
python $GITHUB_ACTION_PATH/action/main.py | tee -a $GITHUB_STEP_SUMMARY runner="python"
else else
python3 $GITHUB_ACTION_PATH/action/main.py | tee -a $GITHUB_STEP_SUMMARY runner="python3"
fi fi
out=$(${runner} $GITHUB_ACTION_PATH/action/main.py)
exit_code=$?
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
# Exit with the exit-code returned by Black
exit ${exit_code}
env: env:
# TODO: Remove once https://github.com/actions/runner/issues/665 is fixed. # TODO: Remove once https://github.com/actions/runner/issues/665 is fixed.
INPUT_OPTIONS: ${{ inputs.options }} INPUT_OPTIONS: ${{ inputs.options }}