Skip to content

Commit 8eb4776

Browse files
committed
working?
1 parent 47c0e61 commit 8eb4776

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

.github/actions/setup/action.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,29 @@ runs:
3434
3535
echo "::set-output name=SCRIPTS_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- scripts | wc -l)"
3636
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
4539
shell: bash
4640
run: |
4741
# Read from openapitools.json and put each client in the specs array
4842
specs=""
4943
generators=( $(cat openapitools.json | jq '."generator-cli".generators' | jq -r 'keys[]') )
5044
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+
5147
for generator in "${generators[@]}"; do
5248
client=${generator#*-}
5349
if [[ ! ${specs[*]} =~ $client ]]; then
5450
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
5652
specs="$specs $client"
5753
fi
5854
fi
5955
done
6056
6157
# Convert the array to json for the matrix
6258
if [[ $specs == "" ]]; then
59+
# client cannot be empty or the matrix will fail
6360
specs_matrix='{"client":["no-run"]}'
6461
run_specs=0
6562
else
@@ -78,12 +75,12 @@ runs:
7875
outputs:
7976
RUN_SPECS:
8077
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 }}
8283

8384
RUN_CTS:
8485
description: Determine if the `cts` job should run
8586
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 }}

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828

2929
outputs:
3030
RUN_SPECS: ${{ steps.setup.outputs.RUN_SPECS }}
31-
RUN_CTS: ${{ steps.setup.outputs.RUN_CTS }}
32-
3331
SPECS_MATRIX: ${{ steps.setup.outputs.SPECS_MATRIX }}
3432

33+
RUN_CTS: ${{ steps.setup.outputs.RUN_CTS }}
34+
3535
specs:
3636
runs-on: ubuntu-20.04
3737
needs: setup

0 commit comments

Comments
 (0)