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

output the raw summary passed to GH Actions Job Summaries #45

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/selftest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
internal-be-careful-allow-failure: true
- name: assert expected output
env:
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.internal-be-careful-output }}"
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.summary-output-base64 }}"
run: |
grep -E 'pyyaml\s+\|\s+5.1' <<< $(base64 -d <<< "${PIP_AUDIT_OUTPUT}")

Expand All @@ -41,7 +41,7 @@ jobs:
internal-be-careful-allow-failure: true
- name: assert expected output
env:
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.internal-be-careful-output }}"
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.summary-output-base64 }}"
run: |
grep -E 'pyyaml\s+\|\s+5.1' <<< $(base64 -d <<< "${PIP_AUDIT_OUTPUT}")

Expand All @@ -67,7 +67,7 @@ jobs:
internal-be-careful-allow-failure: true
- name: assert expected output
env:
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.internal-be-careful-output }}"
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.summary-output-base64 }}"
run: |
grep -E 'pyyaml\s+\|\s+5.1' <<< $(base64 -d <<< "${PIP_AUDIT_OUTPUT}")

Expand All @@ -85,9 +85,10 @@ jobs:
internal-be-careful-allow-failure: true
- name: assert expected output
env:
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.internal-be-careful-output }}"
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.summary-output-base64 }}"
run: |
grep -E 'pyyaml\s+\|\s+5.1' <<< $(base64 -d <<< "${PIP_AUDIT_OUTPUT}")

selftest-pipaudit-fail:
runs-on: ubuntu-latest
steps:
Expand All @@ -103,6 +104,6 @@ jobs:
internal-be-careful-allow-failure: true
- name: assert expected output
env:
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.internal-be-careful-output }}"
PIP_AUDIT_OUTPUT: "${{ steps.pip-audit.outputs.summary-output-base64 }}"
run: |
grep 'pip-audit did not return any output' <<< $(base64 -d <<< "${PIP_AUDIT_OUTPUT}")
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ The `summary` setting controls whether a GitHub
[job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
is rendered at the end of the action.

__Note:__ The markdown-formatted summary is base64 wrapped and output to the variable `summary-output-base64` when job summaries are enabled.

Example:

```yaml
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ inputs:
required: false
default: ""
outputs:
internal-be-careful-output:
summary-output-base64:
description: "the column-formatted output from pip-audit, wrapped as base64"
value: "${{ steps.pip-audit.outputs.output }}"
runs:
Expand All @@ -72,6 +72,10 @@ runs:
source "${{ github.action_path }}/setup/venv.bash"

python "${{ github.action_path }}/action.py" "${{ inputs.inputs }}"

if [[ "${GHA_PIP_AUDIT_SUMMARY}" = "true" ]]; then
echo "markdown-summary=$(<${GITHUB_STEP_SUMMARY})" >> ${GITHUB_OUTPUT}
fi
env:
GHA_PIP_AUDIT_SUMMARY: "${{ inputs.summary }}"
dom-colangelo marked this conversation as resolved.
Show resolved Hide resolved
GHA_PIP_AUDIT_NO_DEPS: "${{ inputs.no-deps }}"
Expand Down
Loading