diff --git a/.github/workflows/check-code-generation-task.yml b/.github/workflows/check-code-generation-task.yml index f3b95d72..195969f5 100644 --- a/.github/workflows/check-code-generation-task.yml +++ b/.github/workflows/check-code-generation-task.yml @@ -5,6 +5,7 @@ env: GO_VERSION: "1.16" on: + create: push: paths: - ".github/workflows/check-code-generation-task.ya?ml" @@ -23,7 +24,32 @@ on: - "etc/schemas/**/*.json" jobs: + run-determination: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if the rest of the workflow should run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. + if [[ \ + "${{ github.event_name }}" != "create" || \ + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ + ]]; then + # Run the other jobs. + RESULT="true" + else + # There is no need to run the other jobs. + RESULT="false" + fi + + echo "::set-output name=result::$RESULT" + check: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/check-go-task.yml b/.github/workflows/check-go-task.yml index bcb2cc32..9667786b 100644 --- a/.github/workflows/check-go-task.yml +++ b/.github/workflows/check-go-task.yml @@ -7,6 +7,7 @@ env: # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: + create: push: paths: - ".github/workflows/check-go-task.ya?ml" @@ -25,7 +26,32 @@ on: repository_dispatch: jobs: + run-determination: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if the rest of the workflow should run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. + if [[ \ + "${{ github.event_name }}" != "create" || \ + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ + ]]; then + # Run the other jobs. + RESULT="true" + else + # There is no need to run the other jobs. + RESULT="false" + fi + + echo "::set-output name=result::$RESULT" + check-errors: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: @@ -47,6 +73,8 @@ jobs: run: task go:vet check-outdated: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: @@ -71,6 +99,8 @@ jobs: run: git diff --color --exit-code check-style: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: @@ -95,6 +125,8 @@ jobs: run: task --silent go:lint check-formatting: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: @@ -120,6 +152,8 @@ jobs: check-config: name: check-config (${{ matrix.module.path }}) + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/publish-go-tester-task.yml b/.github/workflows/publish-go-tester-task.yml index 383aecb9..ab9b83cf 100644 --- a/.github/workflows/publish-go-tester-task.yml +++ b/.github/workflows/publish-go-tester-task.yml @@ -3,6 +3,7 @@ name: Publish Tester Build # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: + create: push: paths: - ".github/workflows/publish-go-tester-task.ya?ml" @@ -28,7 +29,32 @@ env: BUILDS_ARTIFACT: build-artifacts jobs: + run-determination: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if the rest of the workflow should run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. + if [[ \ + "${{ github.event_name }}" != "create" || \ + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ + ]]; then + # Run the other jobs. + RESULT="true" + else + # There is no need to run the other jobs. + RESULT="false" + fi + + echo "::set-output name=result::$RESULT" + build: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index 91e04288..1d2c2d62 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -9,6 +9,7 @@ env: # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: + create: push: paths: - ".github/workflows/test-go-integration-task.ya?ml" @@ -33,7 +34,33 @@ on: repository_dispatch: jobs: + run-determination: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if the rest of the workflow should run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. + if [[ \ + "${{ github.event_name }}" != "create" || \ + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ + ]]; then + # Run the other jobs. + RESULT="true" + else + # There is no need to run the other jobs. + RESULT="false" + fi + + echo "::set-output name=result::$RESULT" + test: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' + strategy: matrix: operating-system: diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index b9c6c858..a6da9b6f 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -7,6 +7,7 @@ env: # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: + create: push: paths: - ".github/workflows/test-go-task.ya?ml" @@ -29,7 +30,33 @@ on: repository_dispatch: jobs: + run-determination: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if the rest of the workflow should run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. + if [[ \ + "${{ github.event_name }}" != "create" || \ + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ + ]]; then + # Run the other jobs. + RESULT="true" + else + # There is no need to run the other jobs. + RESULT="false" + fi + + echo "::set-output name=result::$RESULT" + test: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' + strategy: matrix: operating-system: