Skip to content

Commit fc8a25d

Browse files
authored
Merge branch 'main' into fix/flag-terminator-constant
2 parents 4bdd9c8 + 9ede882 commit fc8a25d

93 files changed

Lines changed: 2350 additions & 2582 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/full-release-validation.yml‎

Lines changed: 139 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,37 @@ jobs:
301301
echo "Dispatched ${workflow}: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
302302
echo "run_id=${run_id}" >> "$GITHUB_OUTPUT"
303303
304+
gh_with_retry() {
305+
local output status attempt
306+
for attempt in 1 2 3 4 5 6; do
307+
set +e
308+
output="$(gh "$@" 2>&1)"
309+
status=$?
310+
set -e
311+
if [[ "$status" -eq 0 ]]; then
312+
printf '%s\n' "$output"
313+
return 0
314+
fi
315+
if [[ "$output" == *"Bad credentials"* || "$output" == *"HTTP 401"* || "$output" == *"secondary rate limit"* || "$output" == *"API rate limit"* ]]; then
316+
echo "::warning::gh $* failed on attempt ${attempt}: ${output}" >&2
317+
sleep $((attempt * 10))
318+
continue
319+
fi
320+
printf '%s\n' "$output" >&2
321+
return "$status"
322+
done
323+
printf '%s\n' "$output" >&2
324+
return "$status"
325+
}
326+
327+
fetch_child_run_json() {
328+
gh_with_retry api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
329+
}
330+
331+
fetch_child_jobs() {
332+
gh_with_retry api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" --jq '.jobs[]'
333+
}
334+
304335
cancel_child() {
305336
if [[ -n "${run_id:-}" ]]; then
306337
echo "Cancelling child workflow ${workflow}: ${run_id}" >&2
@@ -311,26 +342,26 @@ jobs:
311342
312343
poll_count=0
313344
while true; do
314-
status="$(gh run view "$run_id" --json status --jq '.status')"
345+
status="$(fetch_child_run_json | jq -r '.status')"
315346
if [[ "$status" == "completed" ]]; then
316347
break
317348
fi
318349
poll_count=$((poll_count + 1))
319350
if (( poll_count % 10 == 0 )); then
320351
echo "Still waiting on ${workflow}: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
321-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.status != "completed") | {name, status, url}' || true
352+
fetch_child_jobs | jq 'select(.status != "completed") | {name, status, url: .html_url}' || true
322353
fi
323354
sleep 30
324355
done
325356
trap - EXIT INT TERM
326357
327-
conclusion="$(gh run view "$run_id" --json conclusion --jq '.conclusion')"
328-
url="$(gh run view "$run_id" --json url --jq '.url')"
358+
conclusion="$(fetch_child_run_json | jq -r '.conclusion // ""')"
359+
url="$(fetch_child_run_json | jq -r '.html_url')"
329360
echo "${workflow} finished with ${conclusion}: ${url}"
330361
echo "url=${url}" >> "$GITHUB_OUTPUT"
331362
echo "conclusion=${conclusion}" >> "$GITHUB_OUTPUT"
332363
if [[ "$conclusion" != "success" ]]; then
333-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.conclusion != "success" and .conclusion != "skipped") | {name, conclusion, url}' || true
364+
fetch_child_jobs | jq 'select(.conclusion != "success" and .conclusion != "skipped") | {name, conclusion, url: .html_url}' || true
334365
exit 1
335366
fi
336367
}
@@ -401,6 +432,37 @@ jobs:
401432
echo "Dispatched ${workflow}: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
402433
echo "run_id=${run_id}" >> "$GITHUB_OUTPUT"
403434
435+
gh_with_retry() {
436+
local output status attempt
437+
for attempt in 1 2 3 4 5 6; do
438+
set +e
439+
output="$(gh "$@" 2>&1)"
440+
status=$?
441+
set -e
442+
if [[ "$status" -eq 0 ]]; then
443+
printf '%s\n' "$output"
444+
return 0
445+
fi
446+
if [[ "$output" == *"Bad credentials"* || "$output" == *"HTTP 401"* || "$output" == *"secondary rate limit"* || "$output" == *"API rate limit"* ]]; then
447+
echo "::warning::gh $* failed on attempt ${attempt}: ${output}" >&2
448+
sleep $((attempt * 10))
449+
continue
450+
fi
451+
printf '%s\n' "$output" >&2
452+
return "$status"
453+
done
454+
printf '%s\n' "$output" >&2
455+
return "$status"
456+
}
457+
458+
fetch_child_run_json() {
459+
gh_with_retry api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
460+
}
461+
462+
fetch_child_jobs() {
463+
gh_with_retry api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" --jq '.jobs[]'
464+
}
465+
404466
cancel_child() {
405467
if [[ -n "${run_id:-}" ]]; then
406468
echo "Cancelling child workflow ${workflow}: ${run_id}" >&2
@@ -411,26 +473,26 @@ jobs:
411473
412474
poll_count=0
413475
while true; do
414-
status="$(gh run view "$run_id" --json status --jq '.status')"
476+
status="$(fetch_child_run_json | jq -r '.status')"
415477
if [[ "$status" == "completed" ]]; then
416478
break
417479
fi
418480
poll_count=$((poll_count + 1))
419481
if (( poll_count % 10 == 0 )); then
420482
echo "Still waiting on ${workflow}: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
421-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.status != "completed") | {name, status, url}' || true
483+
fetch_child_jobs | jq 'select(.status != "completed") | {name, status, url: .html_url}' || true
422484
fi
423485
sleep 30
424486
done
425487
trap - EXIT INT TERM
426488
427-
conclusion="$(gh run view "$run_id" --json conclusion --jq '.conclusion')"
428-
url="$(gh run view "$run_id" --json url --jq '.url')"
489+
conclusion="$(fetch_child_run_json | jq -r '.conclusion // ""')"
490+
url="$(fetch_child_run_json | jq -r '.html_url')"
429491
echo "${workflow} finished with ${conclusion}: ${url}"
430492
echo "url=${url}" >> "$GITHUB_OUTPUT"
431493
echo "conclusion=${conclusion}" >> "$GITHUB_OUTPUT"
432494
if [[ "$conclusion" != "success" ]]; then
433-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.conclusion != "success" and .conclusion != "skipped") | {name, conclusion, url}' || true
495+
fetch_child_jobs | jq 'select(.conclusion != "success" and .conclusion != "skipped") | {name, conclusion, url: .html_url}' || true
434496
exit 1
435497
fi
436498
}
@@ -511,6 +573,37 @@ jobs:
511573
echo "Dispatched ${workflow}: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
512574
echo "run_id=${run_id}" >> "$GITHUB_OUTPUT"
513575
576+
gh_with_retry() {
577+
local output status attempt
578+
for attempt in 1 2 3 4 5 6; do
579+
set +e
580+
output="$(gh "$@" 2>&1)"
581+
status=$?
582+
set -e
583+
if [[ "$status" -eq 0 ]]; then
584+
printf '%s\n' "$output"
585+
return 0
586+
fi
587+
if [[ "$output" == *"Bad credentials"* || "$output" == *"HTTP 401"* || "$output" == *"secondary rate limit"* || "$output" == *"API rate limit"* ]]; then
588+
echo "::warning::gh $* failed on attempt ${attempt}: ${output}" >&2
589+
sleep $((attempt * 10))
590+
continue
591+
fi
592+
printf '%s\n' "$output" >&2
593+
return "$status"
594+
done
595+
printf '%s\n' "$output" >&2
596+
return "$status"
597+
}
598+
599+
fetch_child_run_json() {
600+
gh_with_retry api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
601+
}
602+
603+
fetch_child_jobs() {
604+
gh_with_retry api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" --jq '.jobs[]'
605+
}
606+
514607
release_check_blocking_job() {
515608
case "$1" in
516609
"resolve_target" | \
@@ -561,20 +654,25 @@ jobs:
561654
562655
poll_count=0
563656
while true; do
564-
status="$(gh run view "$run_id" --json status --jq '.status')"
657+
status="$(fetch_child_run_json | jq -r '.status')"
565658
if [[ "$status" == "completed" ]]; then
566659
break
567660
fi
568661
poll_count=$((poll_count + 1))
569662
if (( poll_count % 10 == 0 )); then
570663
echo "Still waiting on ${workflow}: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
571-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.status != "completed") | {name, status, url}' || true
664+
fetch_child_jobs | jq 'select(.status != "completed") | {name, status, url: .html_url}' || true
572665
fi
573666
sleep 30
574667
done
575668
trap - EXIT INT TERM
576669
577-
run_json="$(gh run view "$run_id" --json conclusion,url,jobs)"
670+
jobs_json="$(fetch_child_jobs | jq -s '{jobs: [.[] | {name, conclusion, url: .html_url}]}')"
671+
run_json="$(
672+
jq -s '.[0] + .[1]' \
673+
<(fetch_child_run_json | jq '{conclusion: (.conclusion // ""), url: .html_url}') \
674+
<(printf '%s\n' "$jobs_json")
675+
)"
578676
conclusion="$(jq -r '.conclusion' <<< "$run_json")"
579677
url="$(jq -r '.url' <<< "$run_json")"
580678
echo "${workflow} finished with ${conclusion}: ${url}"
@@ -787,6 +885,29 @@ jobs:
787885
echo "Dispatched npm-telegram-beta-e2e.yml: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
788886
echo "run_id=${run_id}" >> "$GITHUB_OUTPUT"
789887
888+
gh_with_retry() {
889+
local output status attempt
890+
for attempt in 1 2 3 4 5 6; do
891+
set +e
892+
output="$(gh "$@" 2>&1)"
893+
status=$?
894+
set -e
895+
if [[ "$status" -eq 0 ]]; then
896+
printf '%s\n' "$output"
897+
return 0
898+
fi
899+
if [[ "$output" == *"Bad credentials"* || "$output" == *"HTTP 401"* || "$output" == *"secondary rate limit"* || "$output" == *"API rate limit"* ]]; then
900+
echo "::warning::gh $* failed on attempt ${attempt}: ${output}" >&2
901+
sleep $((attempt * 10))
902+
continue
903+
fi
904+
printf '%s\n' "$output" >&2
905+
return "$status"
906+
done
907+
printf '%s\n' "$output" >&2
908+
return "$status"
909+
}
910+
790911
cancel_child() {
791912
if [[ -n "${run_id:-}" ]]; then
792913
echo "Cancelling child workflow npm-telegram-beta-e2e.yml: ${run_id}" >&2
@@ -797,26 +918,26 @@ jobs:
797918
798919
poll_count=0
799920
while true; do
800-
status="$(gh run view "$run_id" --json status --jq '.status')"
921+
status="$(gh_with_retry run view "$run_id" --json status --jq '.status')"
801922
if [[ "$status" == "completed" ]]; then
802923
break
803924
fi
804925
poll_count=$((poll_count + 1))
805926
if (( poll_count % 10 == 0 )); then
806927
echo "Still waiting on npm-telegram-beta-e2e.yml: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id}"
807-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.status != "completed") | {name, status, url}' || true
928+
gh_with_retry run view "$run_id" --json jobs --jq '.jobs[] | select(.status != "completed") | {name, status, url}' || true
808929
fi
809930
sleep 30
810931
done
811932
trap - EXIT INT TERM
812933
813-
conclusion="$(gh run view "$run_id" --json conclusion --jq '.conclusion')"
814-
url="$(gh run view "$run_id" --json url --jq '.url')"
934+
conclusion="$(gh_with_retry run view "$run_id" --json conclusion --jq '.conclusion')"
935+
url="$(gh_with_retry run view "$run_id" --json url --jq '.url')"
815936
echo "npm-telegram-beta-e2e.yml finished with ${conclusion}: ${url}"
816937
echo "url=${url}" >> "$GITHUB_OUTPUT"
817938
echo "conclusion=${conclusion}" >> "$GITHUB_OUTPUT"
818939
if [[ "$conclusion" != "success" ]]; then
819-
gh run view "$run_id" --json jobs --jq '.jobs[] | select(.conclusion != "success" and .conclusion != "skipped") | {name, conclusion, url}' || true
940+
gh_with_retry run view "$run_id" --json jobs --jq '.jobs[] | select(.conclusion != "success" and .conclusion != "skipped") | {name, conclusion, url}' || true
820941
exit 1
821942
fi
822943

‎.github/workflows/openclaw-npm-release.yml‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on:
3535
- latest
3636

3737
concurrency:
38-
group: openclaw-npm-release-${{ github.event_name == 'workflow_dispatch' && format('{0}-{1}', inputs.tag, inputs.npm_dist_tag) || github.ref }}
38+
group: ${{ github.event_name == 'workflow_dispatch' && inputs.preflight_only && format('openclaw-npm-release-{0}-{1}-preflight', inputs.tag, inputs.npm_dist_tag) || github.event_name == 'workflow_dispatch' && format('openclaw-npm-release-{0}-{1}-publish-{2}', inputs.tag, inputs.npm_dist_tag, github.run_id) || format('openclaw-npm-release-{0}', github.ref) }}
3939
cancel-in-progress: ${{ github.event_name == 'workflow_dispatch' && inputs.preflight_only && inputs.npm_dist_tag == 'alpha' }}
4040

4141
env:
@@ -390,6 +390,8 @@ jobs:
390390
391391
- name: Require preflight artifact promotion on real publish
392392
env:
393+
RELEASE_TAG: ${{ inputs.tag }}
394+
RELEASE_NPM_DIST_TAG: ${{ inputs.npm_dist_tag }}
393395
PREFLIGHT_RUN_ID: ${{ inputs.preflight_run_id }}
394396
FULL_RELEASE_VALIDATION_RUN_ID: ${{ inputs.full_release_validation_run_id }}
395397
RELEASE_PUBLISH_RUN_ID: ${{ inputs.release_publish_run_id }}
@@ -400,8 +402,12 @@ jobs:
400402
exit 1
401403
fi
402404
if [[ -z "${FULL_RELEASE_VALIDATION_RUN_ID}" ]]; then
403-
echo "Real publish requires full_release_validation_run_id from a successful Full Release Validation run." >&2
404-
exit 1
405+
if [[ "${RELEASE_TAG}" == *"-beta."* && "${RELEASE_NPM_DIST_TAG}" == "beta" ]]; then
406+
echo "::warning::Beta publish is proceeding from npm preflight only; full release validation remains required before stable/latest promotion."
407+
else
408+
echo "Real publish requires full_release_validation_run_id from a successful Full Release Validation run." >&2
409+
exit 1
410+
fi
405411
fi
406412
if [[ -z "${RELEASE_PUBLISH_RUN_ID// }" && "${GITHUB_ACTOR}" == "github-actions[bot]" ]]; then
407413
echo "Workflow-dispatched real publish requires release_publish_run_id from the approved OpenClaw Release Publish workflow." >&2
@@ -518,6 +524,7 @@ jobs:
518524
printf '%s' "$RUN_JSON" | node -e 'const fs = require("node:fs"); const run = JSON.parse(fs.readFileSync(0, "utf8")); const checks = [["workflowName", "OpenClaw NPM Release"], ["headBranch", process.env.EXPECTED_PREFLIGHT_BRANCH], ["event", "workflow_dispatch"], ["conclusion", "success"]]; for (const [key, expected] of checks) { if (run[key] !== expected) { console.error(`Referenced npm preflight run ${process.env.PREFLIGHT_RUN_ID} must have ${key}=${expected}, got ${run[key] ?? "<missing>"}.`); process.exit(1); } } console.log(`Using npm preflight run ${process.env.PREFLIGHT_RUN_ID}: ${run.url}`);'
519525
520526
- name: Verify full release validation run metadata
527+
if: ${{ inputs.full_release_validation_run_id != '' }}
521528
env:
522529
GH_TOKEN: ${{ github.token }}
523530
FULL_RELEASE_VALIDATION_RUN_ID: ${{ inputs.full_release_validation_run_id }}
@@ -581,6 +588,7 @@ jobs:
581588
download_preflight_artifact
582589
583590
- name: Download full release validation manifest
591+
if: ${{ inputs.full_release_validation_run_id != '' }}
584592
uses: actions/download-artifact@v8
585593
with:
586594
name: full-release-validation-${{ inputs.full_release_validation_run_id }}
@@ -646,6 +654,7 @@ jobs:
646654
fi
647655
648656
- name: Verify full release validation target
657+
if: ${{ inputs.full_release_validation_run_id != '' }}
649658
run: |
650659
set -euo pipefail
651660
EXPECTED_RELEASE_SHA="$(git rev-parse HEAD)"

0 commit comments

Comments
 (0)