diff --git a/.github/workflows/check-go-cross-build-task.yml b/.github/workflows/check-go-cross-build-task.yml index 02cd7ebe..70ec7ae9 100644 --- a/.github/workflows/check-go-cross-build-task.yml +++ b/.github/workflows/check-go-cross-build-task.yml @@ -6,6 +6,7 @@ env: # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: + create: push: paths: - ".github/workflows/check-go-cross-build-task.ya?ml" @@ -24,7 +25,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" + build: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' + strategy: matrix: os: diff --git a/.github/workflows/publish-go-tester-task.yml b/.github/workflows/publish-go-tester-task.yml index 065ec190..a596886a 100644 --- a/.github/workflows/publish-go-tester-task.yml +++ b/.github/workflows/publish-go-tester-task.yml @@ -10,6 +10,7 @@ env: # 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" @@ -30,7 +31,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" + 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 60bde5c4..059f1961 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 912c1c0c..82116319 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,8 +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: name: test (${{ matrix.module.path }} - ${{ matrix.operating-system }}) + needs: run-determination + if: needs.run-determination.outputs.result == 'true' strategy: fail-fast: false