From 5a904e6ce47214e4ca7cb553af6dce60ec0c9353 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 6 Nov 2022 22:04:23 +0100 Subject: [PATCH] fix(workflow): Use pull request head SHA for checkout Signed-off-by: Tilman Vatteroth --- .github/workflows/deploy-pr.yml | 2 ++ .github/workflows/e2e.yml | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index b5e8d15b2..e74fa9018 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -40,6 +40,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 496f68ad7..e743a8d8a 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -17,7 +17,7 @@ permissions: env: NODE_VERSION: 18 - BUILD_CACHE_KEY: "${{ !!github.event.pull_request && github.event.pull_request.head.sha || github.sha }}" + HEAD_COMMIT_HASH: "${{ !!github.event.pull_request && github.event.pull_request.head.sha || github.sha }}" jobs: build-frontend: @@ -27,13 +27,15 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v3 + with: + ref: ${{ env.HEAD_COMMIT_HASH }} - name: Cache build uses: actions/cache@v3.0.11 id: build-cache with: path: .next - key: ${{ env.BUILD_CACHE_KEY }} + key: ${{ env.HEAD_COMMIT_HASH }} - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -93,7 +95,7 @@ jobs: id: build-cache with: path: .next - key: ${{ env.BUILD_CACHE_KEY }} + key: ${{ env.HEAD_COMMIT_HASH }} - name: Get yarn cache directory path id: yarn-cache-dir-path