Skip to content

Commit 996fd4a

Browse files
authored
Add input to fail Action on OFT error (#6)
1 parent fd154d8 commit 996fd4a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

action.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,23 @@ inputs:
2020
description: The format of the report that OpenFastTrace should produce.
2121
default: "plain"
2222
required: false
23+
fail-on-error:
24+
description: |
25+
By default, the action will never fail but indicate the result of running the trace command in the "oft-exit-code" output variable.
26+
Setting this parameter to "true" will let the Action return the exit code produced by running OpenFastTrace.
27+
default: "false"
28+
required: false
2329
outputs:
2430
oft-exit-code:
2531
description: |
26-
The exit code indicating the outcome of running OpenFastTrace (0: success, 1: failure).
32+
The exit code indicating the outcome of running OpenFastTrace (0: success, > 0: failure).
2733
The report is created in any case, as long as OpenFastTrace could be run at all.
2834
2935
runs:
3036
using: "docker"
3137
image: "Dockerfile"
3238
args:
39+
- ${{ inputs.fail-on-error }}
3340
- ${{ inputs.report-filename }}
3441
- ${{ inputs.report-format }}
3542
- ${{ inputs.file-patterns }}

run-oft.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/sh
22

33
# [impl->req~run-oft-trace-command~1]
4-
5-
report_file_name=$1
6-
report_format=$2
7-
files=$3
4+
fail_on_error=$1
5+
report_file_name=$2
6+
report_format=$3
7+
files=$4
88

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

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

0 commit comments

Comments
 (0)