Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary parameter to action #3958

Merged
merged 3 commits into from Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Expand Up @@ -40,7 +40,7 @@

### Integrations

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
- The summary output for GitHub workflows is now suppressible using the `summary` parameter. (#3958)

### Documentation

Expand Down
14 changes: 10 additions & 4 deletions action.yml
Expand Up @@ -27,6 +27,10 @@ inputs:
description: 'Python Version specifier (PEP440) - e.g. "21.5b1"'
required: false
default: ""
summary:
description: "Whether to add the output to the workflow summary"
required: false
default: true
branding:
color: "black"
icon: "check-circle"
Expand All @@ -47,10 +51,12 @@ runs:
# 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
if [ "${{ inputs.summary }}" == "true" ]; then
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi

# Exit with the exit-code returned by Black
exit ${exit_code}
Expand Down