Added many, many more actions.
This commit is contained in:
44
utils/compare/action.yaml
Normal file
44
utils/compare/action.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
name: compare
|
||||
description: "Compare the output of a command to an expected value."
|
||||
inputs:
|
||||
expected:
|
||||
description: "Expected output."
|
||||
required: false
|
||||
actual:
|
||||
description: "Actual output."
|
||||
required: true
|
||||
exitOnFail:
|
||||
description: "Should the program exit on a failure."
|
||||
required: true
|
||||
default: "true"
|
||||
outputs:
|
||||
success:
|
||||
description: "The result of the comparison."
|
||||
value: ${{ steps.compare.outputs.success }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Compare input and output"
|
||||
id: compare
|
||||
run: |
|
||||
EXPECTED=$(cat <<EOF
|
||||
${{ inputs.expected }}
|
||||
EOF
|
||||
)
|
||||
ACTUAL=$(cat <<EOF
|
||||
${{ inputs.actual }}
|
||||
EOF
|
||||
)
|
||||
|
||||
if [[ "$EXPECTED" == "$ACTUAL" ]]; then
|
||||
echo "success=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "success=false" >> "$GITHUB_OUTPUT"
|
||||
if [[ "${{ inputs.exitOnFail }}" == "true" ]]; then
|
||||
echo EXPECTED: "$EXPECTED"
|
||||
echo --------------------------------
|
||||
echo ACTUAL: "$ACTUAL"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
shell: bash
|
||||
Reference in New Issue
Block a user