Skip to content

Commit

Permalink
Add input to fail Action on OFT error
Browse files Browse the repository at this point in the history
  • Loading branch information
sophokles73 committed Aug 22, 2024
1 parent fd154d8 commit dc9b094
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
9 changes: 8 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ inputs:
description: The format of the report that OpenFastTrace should produce.
default: "plain"
required: false
fail-on-error:
description: |
By default, the action will never fail but indicate the result of running the trace command in the "oft-exit-code" output variable.
Setting this parameter to "true" will let the Action return the exit code produced by running OpenFastTrace.
default: "false"
required: false
outputs:
oft-exit-code:
description: |
The exit code indicating the outcome of running OpenFastTrace (0: success, 1: failure).
The exit code indicating the outcome of running OpenFastTrace (0: success, > 0: failure).
The report is created in any case, as long as OpenFastTrace could be run at all.
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.fail-on-error }}
- ${{ inputs.report-filename }}
- ${{ inputs.report-format }}
- ${{ inputs.file-patterns }}
14 changes: 9 additions & 5 deletions run-oft.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh

# [impl->req~run-oft-trace-command~1]

report_file_name=$1
report_format=$2
files=$3
fail_on_error=$1
report_file_name=$2
report_format=$3
files=$4

echo "::notice::using OpenFastTrace JARs from: ${LIB_DIR}"

Expand All @@ -19,6 +19,10 @@ then
echo "oft-exit-code=0" >> "${GITHUB_OUTPUT}"
echo "All specification items are covered." >> "${GITHUB_STEP_SUMMARY}"
else
echo "oft-exit-code=$?" >> "${GITHUB_OUTPUT}"
oft_exit_code=$?
echo "oft-exit-code=${oft_exit_code}" >> "${GITHUB_OUTPUT}"
echo "Some specification items are not covered. See created report (${report_file_name}) for details." >> "${GITHUB_STEP_SUMMARY}"
if [ "${fail_on_error}" = "true" ]; then
exit ${oft_exit_code}
fi
fi

0 comments on commit dc9b094

Please sign in to comment.