-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing JSON output or composite action (#277)
* Add JSON output to composite action * Move asserting JSON output into composite action, reuse in all publish jobs
- Loading branch information
Showing
5 changed files
with
122 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: 'Assert JSON output' | ||
author: 'EnricoMi' | ||
description: 'A GitHub Action that asserts the publish action''s JSON output' | ||
|
||
inputs: | ||
json: | ||
description: 'JSON content to assess.' | ||
required: true | ||
json_file: | ||
description: 'Path to the JSON file to assess.' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: JSON file | ||
shell: bash | ||
run: | | ||
jq . "${{ inputs.json_file }}" | ||
jq .conclusion "${{ inputs.json_file }}" | ||
- name: JSON output | ||
if: always() | ||
env: | ||
TITLE: ${{ fromJSON( inputs.json ).title }} | ||
SUMMARY: ${{ fromJSON( inputs.json ).summary }} | ||
CONCLUSION: ${{ fromJSON( inputs.json ).conclusion }} | ||
STATS: ${{ toJSON( fromJSON( inputs.json ).stats ) }} | ||
STATS_WITH_DELTA: ${{ toJSON( fromJSON( inputs.json ).stats_with_delta ) }} | ||
COMMIT: ${{ fromJSON( inputs.json ).stats.commit }} | ||
REFERENCE: ${{ fromJSON( inputs.json ).stats_with_delta.reference_commit }} | ||
ANNOTATIONS: ${{ fromJSON( inputs.json ).annotations }} | ||
shell: bash | ||
run: | | ||
echo "title=$TITLE" | ||
echo "summary=$SUMMARY" | ||
echo "conclusion=$CONCLUSION" | ||
echo "stats=$STATS" | ||
echo "stats-with-delta=$STATS_WITH_DELTA" | ||
echo "commit=$COMMIT" | ||
echo "reference=$REFERENCE" | ||
echo "annotations=$ANNOTATIONS" | ||
echo | ||
echo "JSON output:" | ||
cat <<EOF | ||
${{ inputs.json }} | ||
EOF | ||
echo | ||
if [[ "$CONCLUSION" != "success" ]] | ||
then | ||
echo 'conclusion != "success"' | ||
exit 1 | ||
fi | ||
branding: | ||
icon: 'check-circle' | ||
color: 'green' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters