File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,25 @@ jobs:
4545 ghcr.io/${{ github.repository_owner }}/goss
4646
4747 - name : Get latest git tag
48- uses : actions-ecosystem/action-get-latest-tag@v1
48+ if : github.ref_name == 'master'
4949 id : get-latest-tag
50+ run : |
51+ # source: https://github.com/actions-ecosystem/action-get-latest-tag/blob/main/entrypoint.sh
52+ set -e
53+ git config --global --add safe.directory /github/workspace
54+ git fetch --tags --force
55+ # This suppress an error occurred when the repository is a complete one.
56+ git fetch --prune --unshallow 2>/dev/null || true
57+ latest_tag=$(git describe --abbrev=0 --tags || true)
58+ echo "tag=${latest_tag}" >> "$GITHUB_OUTPUT"
59+ echo "Latest tag: $latest_tag"
5060
5161 - name : Set short git commit SHA
62+ if : github.ref_name == 'master'
5263 run : |
5364 calculatedSha=$(git rev-parse --short ${{ github.sha }})
5465 echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
66+ echo "COMMIT_SHORT_SHA: $calculatedSha"
5567
5668 - name : Get the current version of Go from project.
5769 run : echo "GO_VERSION_FROM_PROJECT=$(go mod edit -json | jq -r .Go)" >> $GITHUB_ENV
You can’t perform that action at this time.
0 commit comments