@@ -34,32 +34,29 @@ runs:
34
34
35
35
echo "::set-output name=SCRIPTS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- scripts | wc -l)"
36
36
37
- - name : Set temporary variables
38
- id : tmpvar
39
- shell : bash
40
- run : |
41
- echo ::set-output name=BASE_SPEC::${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 }}
42
-
43
- - name : matrix
44
- id : set-matrix
37
+ - name : Compute specs matrix
38
+ id : spec-matrix
45
39
shell : bash
46
40
run : |
47
41
# Read from openapitools.json and put each client in the specs array
48
42
specs=""
49
43
generators=( $(cat openapitools.json | jq '."generator-cli".generators' | jq -r 'keys[]') )
50
44
45
+ base_changed=${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 }}
46
+
51
47
for generator in "${generators[@]}"; do
52
48
client=${generator#*-}
53
49
if [[ ! ${specs[*]} =~ $client ]]; then
54
50
changed=$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- specs/$client | wc -l)
55
- if [[ $changed > 0 ]]; then
51
+ if [[ $base_changed || $ changed > 0 ]]; then
56
52
specs="$specs $client"
57
53
fi
58
54
fi
59
55
done
60
56
61
57
# Convert the array to json for the matrix
62
58
if [[ $specs == "" ]]; then
59
+ # client cannot be empty or the matrix will fail
63
60
specs_matrix='{"client":["no-run"]}'
64
61
run_specs=0
65
62
else
@@ -78,12 +75,12 @@ runs:
78
75
outputs :
79
76
RUN_SPECS :
80
77
description : Whether to run specs or not
81
- value : ${{ steps.set-matrix.outputs.RUN_SPECS }}
78
+ value : ${{ steps.spec-matrix.outputs.RUN_SPECS }}
79
+
80
+ SPECS_MATRIX :
81
+ description : Generate the matrix for specs
82
+ value : ${{ steps.spec-matrix.outputs.SPECS_MATRIX }}
82
83
83
84
RUN_CTS :
84
85
description : Determine if the `cts` job should run
85
86
value : ${{ github.ref_name == 'main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 || steps.diff.outputs.TESTS_CHANGED > 0 || steps.diff.outputs.JS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 || steps.diff.outputs.JAVA_CLIENT_CHANGED > 0 || steps.diff.outputs.JAVA_TEMPLATE_CHANGED > 0 }}
86
-
87
- SPECS_MATRIX :
88
- description : Generate the matrix for specs
89
- value : ${{ steps.set-matrix.outputs.SPECS_MATRIX }}
0 commit comments