Skip to content

Commit

Permalink
Added check to select branch name based on ref_type
Browse files Browse the repository at this point in the history
  • Loading branch information
MukuFlash03 committed Oct 1, 2024
1 parent b892faa commit d540107
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/image_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ jobs:
steps:
- name: Print commit info
run: |
echo "Commit author: ${{ github.event.commits[0].author.name }}"
echo "Head commit author: ${{ github.event.head_commit.author.name }}"
echo "Commit message: ${{ github.event.head_commit.message }}"
echo "Head commit author: ${{ github.event.head_commit.author.name }}"
echo "Event name: ${{ github.event_name }}"
echo "Actor: ${{ github.actor }}"
echo "Ref: ${{ github.ref }}"
Expand All @@ -60,12 +59,16 @@ jobs:
branch_name: ${{ steps.get-branch-name.outputs.branch_name }}

steps:
- name: Remove prefix from branch name
- name: Get branch name based on ref_type
id: get-branch-name
run: |
base_ref=${{ github.event.base_ref }}
echo "Branch name: branch_name=${base_ref#refs/heads/}"
echo "branch_name=${base_ref#refs/heads/}" >> "$GITHUB_OUTPUT"
if [ "${{ github.ref_type }}" == "tag" ]; then
base_ref=${{ github.event.base_ref }}
echo "Branch name: branch_name=${base_ref#refs/heads/}"
echo "branch_name=${base_ref#refs/heads/}" >> "$GITHUB_OUTPUT"
elif [ "${{ github.ref_type }}" == "branch" ]; then
echo "branch_name=:${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
fi
build:
if: ${{ !contains(github.event.head_commit.author.name, 'Github Actions bot to update .env with latest tags') }}
Expand Down

0 comments on commit d540107

Please sign in to comment.