From 4b61e0d80cf709918f7d9a2a1b5b5ab8f3b0e563 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:09:18 +0200 Subject: [PATCH] Fix branch name detection --- .github/workflows/pr.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 538a3813b..e0454b601 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -35,9 +35,14 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.PAT_TOKEN }} - - name: Get current branch name - id: get_branch - run: echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + - name: Determine the branch name + id: determine_branch + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "branch_name=${{ github.head_ref }}" >> $GITHUB_ENV + else + echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + fi - name: Replace / with - in branch name id: replace_slash