From 0bebd396dfa143fc46df1041bcf7f2908ec1474a Mon Sep 17 00:00:00 2001 From: Deluan Date: Sat, 21 Dec 2024 20:15:24 -0500 Subject: [PATCH] build(ci): use the head commit sha in PR versions Ref: https://stackoverflow.com/a/68068674 Signed-off-by: Deluan --- .github/workflows/pipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 64b7605de..0ead4dd44 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -36,6 +36,7 @@ jobs: echo "git describe --tags: $(git describe --tags `git rev-list --tags --max-count=1`)" echo "git tag: $(git tag --sort=-committerdate | head -n 1)" echo "github_ref: $GITHUB_REF" + echo "github_head_sha: ${{ github.event.pull_request.head.sha }}" git tag -l - name: Determine git current SHA and latest tag id: git-version @@ -50,6 +51,7 @@ jobs: GIT_SHA=$(git rev-parse --short HEAD) PR_NUM=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") if [[ $PR_NUM != "null" ]]; then + GIT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-8) GIT_SHA="pr-${PR_NUM}/${GIT_SHA}" fi echo "GIT_SHA=$GIT_SHA" >> $GITHUB_OUTPUT