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

Post summary as workflow output #39

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ Insights Engineering

### Outputs

None
* `summary`:

_Description_: A summary of coverage report
<!-- END_ACTION_DOC -->

## How it works
Expand Down
20 changes: 19 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ inputs:
required: false
default: false

outputs:
summary:
description: Summary of coverage report
value: ${{ steps.create-output.outputs.summary }}

branding: # https://feathericons.com/
icon: "umbrella"
color: "red"
Expand Down Expand Up @@ -264,7 +269,11 @@ runs:
fi
echo -e "\nResults for commit: $COMMIT_SHA\n" >> .coverage-output.final
echo -e "\n_Minimum allowed coverage is \`${{ inputs.threshold }}%\`_\n" >> .coverage-output.final
echo -e "\n:recycle: This comment has been updated with latest results\n" >> .coverage-output.final
if [[ "${{ inputs.publish }}" == "true" ]]
then {
echo -e "\n:recycle: This comment has been updated with latest results\n" >> .coverage-output.final
}
fi
shell: bash

- name: Post as comment
Expand All @@ -274,6 +283,15 @@ runs:
header: ${{ inputs.path }}
path: .coverage-output.final

- name: Set as output
id: create-output
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "summary<<$EOF" >> $GITHUB_OUTPUT
echo "$(cat .coverage-output.final)" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
shell: bash

- name: Commit XML report to ${{ inputs.diff-storage }}
if: >
contains(inputs.diff, 'true')
Expand Down