mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-31 18:30:39 +02:00
fix(ci): quality-gate drops the 74s full-history checkout
fetch-depth:0 cost 74 of the job's 92 seconds; the three gates it feeds take ~12s combined. Shallow checkout + exact-SHA fetches for the diff's base/head (an exact-SHA fetch, not a guessed depth — long-lived branches and merge queues still resolve), with a --deepen fallback for push events whose 'before' is unusable. timeout right-sized 20→10 min. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
adaad18124
commit
5cdc02f555
@@ -29,11 +29,13 @@ concurrency:
|
||||
jobs:
|
||||
quality:
|
||||
runs-on: ubicloud-standard-8
|
||||
timeout-minutes: 20
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
# Shallow checkout: fetch-depth:0 cost 74s of a 92s job for checks that
|
||||
# take ~12s combined. The one history consumer (the added-lines diff)
|
||||
# fetches its exact base/head SHAs below — an exact-SHA fetch, not a
|
||||
# guessed depth, so long-lived branches and merge queues still resolve.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
with:
|
||||
bun-version: 1.3.13
|
||||
@@ -47,7 +49,15 @@ jobs:
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# Exact-SHA shallow fetches: the checkout above is depth-1 of the
|
||||
# merge ref; the diff needs the PR head + base objects specifically.
|
||||
git fetch --no-tags --depth=1 origin "$HEAD_SHA" 2>/dev/null || true
|
||||
git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null \
|
||||
|| git fetch --no-tags --depth=1 origin "$BASE_SHA" 2>/dev/null || true
|
||||
if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
|
||||
# push with an unusable `before` (branch create / force push):
|
||||
# deepen once so HEAD^ exists as the fallback base.
|
||||
git fetch --no-tags --deepen=1 origin 2>/dev/null || true
|
||||
BASE_SHA=$(git rev-parse HEAD^)
|
||||
fi
|
||||
git diff --unified=0 --no-color "$BASE_SHA" "$HEAD_SHA" -- \
|
||||
|
||||
Reference in New Issue
Block a user