Skip to content

Commit

Permalink
Add output parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
marcransome committed Aug 23, 2024
1 parent b4d97b8 commit de2f859
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ inputs:
description: 'Produce raw TAP output'
required: false
default: 'false'
outputs:
passed:
description: "Number of tests passed"
value: ${{ steps.run-fishtape-tests.outputs.passed }}
failed:
description: "Number of tests failed"
value: ${{ steps.run-fishtape-tests.outputs.failed }}
total:
description: "Total number of tests executed"
value: ${{ steps.run-fishtape-tests.outputs.total }}
runs:
using: 'composite'
steps:
Expand All @@ -24,6 +34,7 @@ runs:
run: npm install -g tap-diff
shell: fish {0}
- name: Run fishtape tests
id: run-fishtape-tests
env:
PATTERNS: ${{ inputs.patterns }}
RAW_OUTPUT: ${{ inputs.raw-output }}
Expand All @@ -41,10 +52,23 @@ runs:
switch $raw_output
case true
fishtape $files
fishtape $files | tee output
case false
fishtape $files | tap-diff
fishtape $files | tee output | tap-diff
case '*'
echo "Unrecognised raw output option: '$raw_output'" >&2; and exit 1
echo "Unrecognised raw output option: '$raw_output'" >&2
exit 1
end
tail -n 3 output | \
perl -pe \
's/^\d\.\.(?<total>\d+)$/$+{total}/g; \
s/^# pass (?<passed>\d+)$/$+{passed}/g; \
s/^# fail (?<failed>\d+)$/$+{failed}/g; \
s/\n/ /g' | \
read total passed failed
echo "{total}=${total}" >> "$GITHUB_OUTPUT"
echo "{passed}=${passed}" >> "$GITHUB_OUTPUT"
echo "{failed}=${failed}" >> "$GITHUB_OUTPUT"
shell: fish {0}

0 comments on commit de2f859

Please sign in to comment.