From 0b2cd9cc414a2466a59fc7c8a571a867f05c4bfe Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 29 Jun 2026 16:21:41 -0700 Subject: [PATCH] chore(ci): dedupe workflow sanity checkout (#97946) --- .github/workflows/workflow-sanity.yml | 65 ++------------------------- 1 file changed, 4 insertions(+), 61 deletions(-) diff --git a/.github/workflows/workflow-sanity.yml b/.github/workflows/workflow-sanity.yml index 81e1ec26f887..76b98daee98b 100644 --- a/.github/workflows/workflow-sanity.yml +++ b/.github/workflows/workflow-sanity.yml @@ -25,7 +25,8 @@ jobs: if: github.event_name != 'workflow_dispatch' runs-on: ubuntu-24.04 steps: - - name: Checkout + - &workflow_sanity_checkout_step + name: Checkout env: CHECKOUT_REPO: ${{ github.repository }} CHECKOUT_SHA: ${{ github.sha }} @@ -84,36 +85,7 @@ jobs: if: github.event_name != 'workflow_dispatch' runs-on: ubuntu-24.04 steps: - - name: Checkout - env: - CHECKOUT_REPO: ${{ github.repository }} - CHECKOUT_SHA: ${{ github.sha }} - run: | - set -euo pipefail - git init "$GITHUB_WORKSPACE" - git -C "$GITHUB_WORKSPACE" config gc.auto 0 - git -C "$GITHUB_WORKSPACE" remote add origin "https://github.com/${CHECKOUT_REPO}.git" - fetch_checkout_ref() { - local fetch_status - for attempt in 1 2 3; do - timeout --signal=TERM --kill-after=10s 30s git -C "$GITHUB_WORKSPACE" \ - -c protocol.version=2 \ - fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \ - "+${CHECKOUT_SHA}:refs/remotes/origin/checkout" && return 0 - fetch_status="$?" - if [ "$fetch_status" != "124" ] && [ "$fetch_status" != "137" ]; then - return "$fetch_status" - fi - if [ "$attempt" = "3" ]; then - return "$fetch_status" - fi - echo "::warning::checkout fetch for '$CHECKOUT_SHA' timed out on attempt $attempt; retrying" - sleep 5 - done - } - fetch_checkout_ref - git -C "$GITHUB_WORKSPACE" checkout --detach refs/remotes/origin/checkout - + - *workflow_sanity_checkout_step - name: Setup Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: @@ -228,36 +200,7 @@ jobs: if: github.event_name == 'workflow_dispatch' runs-on: ubuntu-24.04 steps: - - name: Checkout - env: - CHECKOUT_REPO: ${{ github.repository }} - CHECKOUT_SHA: ${{ github.sha }} - run: | - set -euo pipefail - git init "$GITHUB_WORKSPACE" - git -C "$GITHUB_WORKSPACE" config gc.auto 0 - git -C "$GITHUB_WORKSPACE" remote add origin "https://github.com/${CHECKOUT_REPO}.git" - fetch_checkout_ref() { - local fetch_status - for attempt in 1 2 3; do - timeout --signal=TERM --kill-after=10s 30s git -C "$GITHUB_WORKSPACE" \ - -c protocol.version=2 \ - fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \ - "+${CHECKOUT_SHA}:refs/remotes/origin/checkout" && return 0 - fetch_status="$?" - if [ "$fetch_status" != "124" ] && [ "$fetch_status" != "137" ]; then - return "$fetch_status" - fi - if [ "$attempt" = "3" ]; then - return "$fetch_status" - fi - echo "::warning::checkout fetch for '$CHECKOUT_SHA' timed out on attempt $attempt; retrying" - sleep 5 - done - } - fetch_checkout_ref - git -C "$GITHUB_WORKSPACE" checkout --detach refs/remotes/origin/checkout - + - *workflow_sanity_checkout_step - name: Setup Node environment uses: ./.github/actions/setup-node-env with: