Pārlūkot izejas kodu

ci(fix): skip flow when there are no changes

```
Error when evaluating 'strategy' for job 'run_emqx_app_tests'. emqx/emqx/.github/workflows/run_emqx_app_tests.yaml@689347f60e5e2e5fc612aa0282c74c0eb26e8281 (Line: 65, Col: 9): Matrix must define at least one vector
```
Thales Macedo Garitezi 1 gadu atpakaļ
vecāks
revīzija
cb3be25ff4
1 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. 7 2
      .github/workflows/run_emqx_app_tests.yaml

+ 7 - 2
.github/workflows/run_emqx_app_tests.yaml

@@ -35,6 +35,7 @@ jobs:
         shell: bash
     outputs:
       matrix: ${{ steps.matrix.outputs.matrix }}
+      skip: ${{ steps.matrix.outputs.skip }}
     steps:
     - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
       with:
@@ -49,12 +50,16 @@ jobs:
         changed_files="$(git diff --name-only ${BEFORE_REF} ${AFTER_REF} apps/emqx)"
         if [ "$changed_files" = '' ]; then
           echo "nothing changed in apps/emqx, ignored."
-          echo "matrix=[]" | tee -a $GITHUB_OUTPUT
+          echo 'matrix=[]' | tee -a $GITHUB_OUTPUT
+          echo 'skip=true' | tee -a $GITHUB_OUTPUT
           exit 0
+        else
+          echo 'skip=false' | tee -a $GITHUB_OUTPUT
+          echo 'matrix=[{"type": "eunit_proper_and_static"},{"type": "1_3"},{"type": "2_3"},{"type": "3_3"}]' | tee -a $GITHUB_OUTPUT
         fi
-        echo 'matrix=[{"type": "eunit_proper_and_static"},{"type": "1_3"},{"type": "2_3"},{"type": "3_3"}]' | tee -a $GITHUB_OUTPUT
 
   run_emqx_app_tests:
+    if: needs.prepare_matrix.outputs.skip != 'true'
     needs:
       - prepare_matrix
     runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}