mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-14 04:17:33 +01:00
ci: keep the route and backstop policy reads inline (git and jq only); docs follow
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ff14f14c63
commit
48a9d92a2f
6 files changed
+29
-11
No files matched your search
@@ -45,11 +45,20 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Read with git and jq only (history-read.sh is git alone): without a train block nothing below runs.
|
||||
# Read with git and jq only: without a train block nothing below runs.
|
||||
- name: Read the train policy (main)
|
||||
id: policy
|
||||
run: |
|
||||
policy=$(bash .github/scripts/history-read.sh "$GITHUB_SHA" .gstack/ship-policy.json --absent null)
|
||||
ref="$GITHUB_SHA" file=.gstack/ship-policy.json policy=null
|
||||
read_failed() { echo "::error::cannot read ${file} at ${ref}. $1 ($(git --version)). Fix: see docs/troubleshooting.md#history-read-failed (HISTORY_READ_FAILED)" >&2; exit 1; }
|
||||
listed=$(git ls-tree --full-tree "$ref" -- "$file") || read_failed "git ls-tree failed"
|
||||
if [ -n "$listed" ]; then
|
||||
for try in 1 2 3; do
|
||||
policy=$(git show "${ref}:${file}") && break
|
||||
if [ "$try" = 3 ]; then read_failed "git show failed 3 times"; fi
|
||||
sleep $((try * 2))
|
||||
done
|
||||
fi
|
||||
train=$(jq -c 'if (.train | type) == "object" then .train else null end' <<<"$policy") || { echo "::error::${GITHUB_SHA}:.gstack/ship-policy.json is not valid JSON; fix the policy file" >&2; exit 1; }
|
||||
if [ -z "$train" ] || [ "$train" = null ]; then
|
||||
echo "train=false" >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -186,7 +186,7 @@ jobs:
|
||||
with:
|
||||
bun-version: 1.4.2
|
||||
|
||||
# Read with git and jq only (history-read.sh is git alone): no repository code decides whether PR pushes start paid work.
|
||||
# Read with git and jq only: no repository code decides whether PR pushes start paid work.
|
||||
- name: Read the train policy (base revision)
|
||||
id: policy
|
||||
env:
|
||||
@@ -194,7 +194,16 @@ jobs:
|
||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
run: |
|
||||
base="${BASE_SHA:-origin/${DEFAULT_BRANCH}}"
|
||||
policy=$(bash .github/scripts/history-read.sh "$base" .gstack/ship-policy.json --absent null)
|
||||
ref="$base" file=.gstack/ship-policy.json policy=null
|
||||
read_failed() { echo "::error::cannot read ${file} at ${ref}. $1 ($(git --version)). Fix: see docs/troubleshooting.md#history-read-failed (HISTORY_READ_FAILED)" >&2; exit 1; }
|
||||
listed=$(git ls-tree --full-tree "$ref" -- "$file") || read_failed "git ls-tree failed"
|
||||
if [ -n "$listed" ]; then
|
||||
for try in 1 2 3; do
|
||||
policy=$(git show "${ref}:${file}") && break
|
||||
if [ "$try" = 3 ]; then read_failed "git show failed 3 times"; fi
|
||||
sleep $((try * 2))
|
||||
done
|
||||
fi
|
||||
train=$(jq -c 'if (.train | type) == "object" then .train else null end' <<<"$policy") || { echo "::error::${base}:.gstack/ship-policy.json is not valid JSON; fix the policy file" >&2; exit 1; }
|
||||
artifact=$(jq -r '.record_artifact // ""' <<<"${train:-null}")
|
||||
check=$(jq -r '.full_gate_check // ""' <<<"${train:-null}")
|
||||
|
||||
Reference in new issue
Block a user