Skip to content

Commit

Permalink
fix default branch getting
Browse files Browse the repository at this point in the history
  • Loading branch information
p-wall committed Jun 13, 2024
1 parent 2006780 commit d2a820d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:
- name: Determine default Git branch name
id: default-branch
run: |
echo "branch=$(sed -e 's/^.*\///' < .git/refs/remotes/origin/HEAD)" >> "$GITHUB_OUTPUT"
default_branch=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }} | jq -r .default_branch)
echo "branch=$default_branch" >> "$GITHUB_OUTPUT"
- name: Determine image tag
id: tag
run: |
if [[ "${{ github.ref_name }}" == "{{ steps.default-branch.outputs.branch }}" ]]; then
if [[ "${{ github.ref_name }}" == "${{ steps.default-branch.outputs.branch }}" ]]; then
echo "image_tag=sha-${{ github.sha }}" >> "$GITHUB_OUTPUT"
else
echo "image_tag=${{ github.ref_name }}-sha-${{ github.sha }}" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit d2a820d

Please sign in to comment.