From 78f00f2e3acacc64749390fcda5981851427e36f Mon Sep 17 00:00:00 2001 From: shortstacked Date: Thu, 10 Apr 2025 13:16:20 +0100 Subject: [PATCH] ci: Change to get the ref once without need for additional checkout (no-changelog) (#14494) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/e2e-reusable.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/e2e-reusable.yml b/.github/workflows/e2e-reusable.yml index 652ad67498..41bd5893d4 100644 --- a/.github/workflows/e2e-reusable.yml +++ b/.github/workflows/e2e-reusable.yml @@ -64,20 +64,22 @@ jobs: # "sha-5d3fe...35d3-time-1620841214" run: echo "value=sha-$GITHUB_SHA-time-$(date +"%s")" >> $GITHUB_OUTPUT + - name: Calculate Git Ref 🤔 + id: calculate_ref + run: | + if [ -n "${{ inputs.pr_number }}" ]; then + echo "value=refs/pull/${{ inputs.pr_number }}/head" >> $GITHUB_OUTPUT + else + echo "value=${{ inputs.branch }}" >> $GITHUB_OUTPUT + fi install: runs-on: blacksmith-4vcpu-ubuntu-2204 needs: ['prepare'] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - ref: ${{ inputs.branch }} - - - name: Checkout PR - if: ${{ inputs.pr_number }} - run: | - git fetch origin pull/${{ inputs.pr_number }}/head - git checkout FETCH_HEAD + ref: ${{ steps.calculate_ref.outputs.value }} - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 @@ -119,15 +121,9 @@ jobs: # running the same tests multiple times containers: ${{ fromJSON( inputs.spec == 'e2e/*' && inputs.containers || '[1]' ) }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - ref: ${{ inputs.branch }} - - - name: Checkout PR - if: ${{ inputs.pr_number }} - run: | - git fetch origin pull/${{ inputs.pr_number }}/head - git checkout FETCH_HEAD + ref: ${{ steps.calculate_ref.outputs.value }} - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0