Skip to content

Commit

Permalink
Update output display to job summary (#3914)
Browse files Browse the repository at this point in the history
* Update output display to job summary

* fix: handled exit-code of script

* added changelog message
  • Loading branch information
csalerno-asml committed Oct 6, 2023
1 parent 3a2d76c commit 3457ec4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -48,6 +48,8 @@

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

- The action output displayed in the job summary is now wrapped in Markdown (#3914)

### Documentation

<!-- Major changes to documentation and policies. Small docs changes
Expand Down
18 changes: 16 additions & 2 deletions action.yml
Expand Up @@ -36,10 +36,24 @@ runs:
- name: black
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
python $GITHUB_ACTION_PATH/action/main.py | tee -a $GITHUB_STEP_SUMMARY
runner="python"
else
python3 $GITHUB_ACTION_PATH/action/main.py | tee -a $GITHUB_STEP_SUMMARY
runner="python3"
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:
# TODO: Remove once https://github.com/actions/runner/issues/665 is fixed.
INPUT_OPTIONS: ${{ inputs.options }}
Expand Down

0 comments on commit 3457ec4

Please sign in to comment.