From 77d5ba9c4ca88175e34a225f87be62c8dcccac38 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sun, 26 Jan 2025 00:02:26 +0000 Subject: [PATCH] fix(github): use latest commit sha For pull requests, GitHub Actions checks out the repo by simulating a merge commit of the PR. But we always want the SHA of the last commit, not the simulated merge commit. --- .github/workflows/build.yml | 1 + scripts/get-version-from-git.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2cc3dad7b1..44f7eb2289b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ 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 }} permissions: {} # No permissions required jobs: build: diff --git a/scripts/get-version-from-git.sh b/scripts/get-version-from-git.sh index ef6be6294ca..8641ab0ca51 100755 --- a/scripts/get-version-from-git.sh +++ b/scripts/get-version-from-git.sh @@ -7,5 +7,6 @@ set -e # Since the deps are fetched from git, we can rev-parse 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 +#VECTOR_SHA=$(git rev-parse --short=7 HEAD) # use the ACTUAL SHA rather than assume develop +#echo $VECTOR_SHA-js-$JSSDK_SHA +echo "${COMMIT_SHA:0:7}-js-$JSSDK_SHA"