|  | 
| 7 | 7 | 
 | 
| 8 | 8 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows | 
| 9 | 9 | on: | 
|  | 10 | +  create: | 
| 10 | 11 |   push: | 
| 11 | 12 |     paths: | 
| 12 | 13 |       - ".github/workflows/check-go-task.ya?ml" | 
|  | 
| 25 | 26 |   repository_dispatch: | 
| 26 | 27 | 
 | 
| 27 | 28 | jobs: | 
|  | 29 | +  run-determination: | 
|  | 30 | +    runs-on: ubuntu-latest | 
|  | 31 | +    outputs: | 
|  | 32 | +      result: ${{ steps.determination.outputs.result }} | 
|  | 33 | +    steps: | 
|  | 34 | +      - name: Determine if the rest of the workflow should run | 
|  | 35 | +        id: determination | 
|  | 36 | +        run: | | 
|  | 37 | +          RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" | 
|  | 38 | +          # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. | 
|  | 39 | +          if [[ \ | 
|  | 40 | +            "${{ github.event_name }}" != "create" || \ | 
|  | 41 | +            "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ | 
|  | 42 | +          ]]; then | 
|  | 43 | +            # Run the other jobs. | 
|  | 44 | +            RESULT="true" | 
|  | 45 | +          else | 
|  | 46 | +            # There is no need to run the other jobs. | 
|  | 47 | +            RESULT="false" | 
|  | 48 | +          fi | 
|  | 49 | +
 | 
|  | 50 | +          echo "::set-output name=result::$RESULT" | 
|  | 51 | +
 | 
| 28 | 52 |   check-errors: | 
| 29 | 53 |     name: check-errors (${{ matrix.module.path }}) | 
|  | 54 | +    needs: run-determination | 
|  | 55 | +    if: needs.run-determination.outputs.result == 'true' | 
| 30 | 56 |     runs-on: ubuntu-latest | 
| 31 | 57 | 
 | 
| 32 | 58 |     strategy: | 
|  | 
| 62 | 88 | 
 | 
| 63 | 89 |   check-outdated: | 
| 64 | 90 |     name: check-outdated (${{ matrix.module.path }}) | 
|  | 91 | +    needs: run-determination | 
|  | 92 | +    if: needs.run-determination.outputs.result == 'true' | 
| 65 | 93 |     runs-on: ubuntu-latest | 
| 66 | 94 | 
 | 
| 67 | 95 |     strategy: | 
| @@ -100,6 +128,8 @@ jobs: | 
| 100 | 128 | 
 | 
| 101 | 129 |   check-style: | 
| 102 | 130 |     name: check-style (${{ matrix.module.path }}) | 
|  | 131 | +    needs: run-determination | 
|  | 132 | +    if: needs.run-determination.outputs.result == 'true' | 
| 103 | 133 |     runs-on: ubuntu-latest | 
| 104 | 134 | 
 | 
| 105 | 135 |     strategy: | 
| @@ -138,6 +168,8 @@ jobs: | 
| 138 | 168 | 
 | 
| 139 | 169 |   check-formatting: | 
| 140 | 170 |     name: check-formatting (${{ matrix.module.path }}) | 
|  | 171 | +    needs: run-determination | 
|  | 172 | +    if: needs.run-determination.outputs.result == 'true' | 
| 141 | 173 |     runs-on: ubuntu-latest | 
| 142 | 174 | 
 | 
| 143 | 175 |     strategy: | 
| @@ -176,6 +208,8 @@ jobs: | 
| 176 | 208 | 
 | 
| 177 | 209 |   check-config: | 
| 178 | 210 |     name: check-config (${{ matrix.module.path }}) | 
|  | 211 | +    needs: run-determination | 
|  | 212 | +    if: needs.run-determination.outputs.result == 'true' | 
| 179 | 213 |     runs-on: ubuntu-latest | 
| 180 | 214 | 
 | 
| 181 | 215 |     strategy: | 
| @@ -208,6 +242,8 @@ jobs: | 
| 208 | 242 |   # Do a simple "smoke test" build for the modules with no other form of validation | 
| 209 | 243 |   build: | 
| 210 | 244 |     name: build (${{ matrix.module.path }}) | 
|  | 245 | +    needs: run-determination | 
|  | 246 | +    if: needs.run-determination.outputs.result == 'true' | 
| 211 | 247 |     runs-on: ubuntu-latest | 
| 212 | 248 | 
 | 
| 213 | 249 |     strategy: | 
|  | 
0 commit comments