Skip to content

Commit e8ae350

Browse files
committed
[#10] Add support for filtering spec items using OFT tags
The OFT Action has been extended to support a new input parameter for specifying tag values which are passed on to the run-oft.sh script.
1 parent d63677c commit e8ae350

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ wget -P $LIB_DIR ${base_url}/openfasttrace/releases/download/$OFT_CORE_VERSION/o
1313
wget -P $LIB_DIR ${base_url}/openfasttrace-asciidoc-plugin/releases/download/$OFT_ASCIIDOC_PLUGIN_VERSION/openfasttrace-asciidoc-plugin-$OFT_ASCIIDOC_PLUGIN_VERSION-with-dependencies.jar
1414
EOF
1515

16-
COPY run-oft.sh /opt/oft/run-oft.sh
16+
COPY run-oft.sh /opt/oft/run-oft.sh
1717

1818
ENTRYPOINT [ "/opt/oft/run-oft.sh" ]

action.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ inputs:
2020
description: The format of the report that OpenFastTrace should produce.
2121
default: "plain"
2222
required: false
23+
tags:
24+
description: |
25+
A comma separated list of tags to use for filtering specification items.
26+
required: false
2327
fail-on-error:
2428
description: |
2529
By default, the action will never fail but indicate the result of running the trace command in the "oft-exit-code" output variable.
@@ -35,8 +39,3 @@ outputs:
3539
runs:
3640
using: "docker"
3741
image: "Dockerfile"
38-
args:
39-
- ${{ inputs.fail-on-error }}
40-
- ${{ inputs.report-filename }}
41-
- ${{ inputs.report-format }}
42-
- ${{ inputs.file-patterns }}

doc/spec/system_requirements.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ Covers:
3333
- feat~standard-github-action~1
3434

3535
Needs: impl
36+
37+
### Filter specification items based on tags
38+
`req~filter-specitems-using-tags~1`
39+
40+
The OFT Action supports filtering relevant specification items using OFT Tags.
41+
42+
Covers:
43+
- feat~standard-github-action~1
44+
45+
Needs: impl

run-oft.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
# [impl->req~run-oft-trace-command~1]
4-
fail_on_error=$1
5-
report_file_name=$2
6-
report_format=$3
7-
files=$4
3+
fail_on_error=${INPUT_FAIL-ON-ERROR:-"false"}
4+
report_file_name=${INPUT_REPORT-FILE-NAME:-"trace-report.txt"}
5+
report_format=${INPUT_REPORT-FORMAT:-"plain"}
6+
tags=${INPUT_TAGS:-""}
7+
file_patterns=${INPUT_FILE-PATTERNS:-"."}
8+
9+
options=(-o "$report_format" -f "$report_file_name")
10+
# [impl->req~filter-specitems-using-tags~1]
11+
if [[ -n "$tags" ]]; then
12+
options=("${options[@]}" -t "$tags")
13+
fi
814

915
echo "::notice::using OpenFastTrace JARs from: ${LIB_DIR}"
16+
echo "::notice::running OpenFastTrace for file patterns: $file_patterns"
1017

11-
# Run OpenFastTrace
18+
# [impl->req~run-oft-trace-command~1]
1219
# shellcheck disable=SC2086
1320
# we need to provide the file patterns unquoted in order for the shell to expand any glob patterns like "*.md"
14-
if (java -cp "${LIB_DIR}/*" \
15-
org.itsallcode.openfasttrace.core.cli.CliStarter trace -o "${report_format}" \
16-
-f "${report_file_name}" \
17-
${files})
21+
if (java -cp "${LIB_DIR}/*" org.itsallcode.openfasttrace.core.cli.CliStarter trace "${options[@]}" $file_patterns)
1822
then
1923
echo "oft-exit-code=0" >> "${GITHUB_OUTPUT}"
2024
echo "All specification items are covered." >> "${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)