From 90a2ab9b8d79ddf5b9cb0c534e4fe03382df0a4c Mon Sep 17 00:00:00 2001 From: zeeket Date: Sun, 26 May 2024 15:52:40 +0300 Subject: [PATCH] fix? --- .github/workflows/create-publish-docker-image.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-publish-docker-image.yml b/.github/workflows/create-publish-docker-image.yml index c2d03d4..a08777a 100644 --- a/.github/workflows/create-publish-docker-image.yml +++ b/.github/workflows/create-publish-docker-image.yml @@ -19,9 +19,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Exit if not on main branch - if: endsWith(github.event.base_ref, 'main') == false - run: exit -1 + - name: Get current branch and exit if not main + run: | + raw=$(git branch -r --contains ${{ github.ref }}) + branch=${raw##*/} + echo "{name}=branch" >> $GITHUB_OUTPUT + echo "Branch is $branch." + if [ "$branch" != "main" ]; then + echo "Not on main branch, exiting." + exit 0 + fi - name: Log in to the Container registry uses: docker/login-action@v2