From f2f06329cbdc8d2d863253aef6717ffe608676c6 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalkowski Date: Sat, 2 Dec 2023 14:45:44 +0100 Subject: [PATCH] change dockerhub push trigger conditions --- .github/workflows/push_dockerhub.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push_dockerhub.yml b/.github/workflows/push_dockerhub.yml index d232175..c047387 100644 --- a/.github/workflows/push_dockerhub.yml +++ b/.github/workflows/push_dockerhub.yml @@ -5,8 +5,8 @@ on: branches: - main pull_request: - branches: - - main + types: + - closed jobs: tests: @@ -22,6 +22,16 @@ jobs: submodules: true token: ${{ secrets.CI_TOKEN }} + - name: Check Branch + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + # Check if the pull request is from the main branch, other branches should not push to dockerhub + if [ "${{ github.event.pull_request.head.ref }}" != "main" ]; then + echo "Skipping workflow for pull request from a branch other than main." + exit 78 + fi + fi + - name: Set up QEMU uses: docker/setup-qemu-action@v1