name: compare-files description: "Compare the output of a command to an expected value." inputs: expected: description: "Expected output file." required: true expectedPattern: description: "Optional pattern to match files in the expected directory." required: false actual: description: "Actual output file." required: true actualPattern: description: "Optional pattern to match files in the actual directory." required: false 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: "Read files." id: read run: | LHS_NUSPEC=$(cat "${{ inputs.expected }}"${{ inputs.expectedPattern }}) RHS_NUSPEC=$(cat "${{ inputs.actual }}"${{ inputs.actualPattern }}) if [[ -n "$LHS_NUSPEC" ]]; then echo "lhs<> "$GITHUB_OUTPUT" echo "$LHS_NUSPEC" >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" fi if [[ -n "$RHS_NUSPEC" ]]; then echo "rhs<> "$GITHUB_OUTPUT" echo "$RHS_NUSPEC" >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" fi shell: bash - name: "Build matrix from yaml." uses: act/common/utils/compare@master with: expected: ${{ steps.read.outputs.lhs }} actual: ${{ steps.read.outputs.rhs }} exitOnFail: ${{ inputs.exitOnFail }}