diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44f7eb2289b..b76145944ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,8 @@ env: # These must be set for fetchdep.sh to get the right branch REPOSITORY: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} - COMMIT_SHA: ${{ github.event.pull_request.head.sha }} + PR_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} + GH_COMMIT_SHA: ${{ github.sha }} permissions: {} # No permissions required jobs: build: diff --git a/scripts/get-version-from-git.sh b/scripts/get-version-from-git.sh index 8641ab0ca51..1bc21a7b148 100755 --- a/scripts/get-version-from-git.sh +++ b/scripts/get-version-from-git.sh @@ -9,4 +9,10 @@ set -e JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=7 HEAD) #VECTOR_SHA=$(git rev-parse --short=7 HEAD) # use the ACTUAL SHA rather than assume develop #echo $VECTOR_SHA-js-$JSSDK_SHA + +# set the version SHA to the PR commit SHA if we're in a PR +# or use the latest main branch commit SHA if we're in a push +COMMIT_SHA=${COMMIT_SHA:-$GH_COMMIT_SHA} +[ -n "$PR_COMMIT_SHA" ] && COMMIT_SHA=$PR_COMMIT_SHA + echo "${COMMIT_SHA:0:7}-js-$JSSDK_SHA"