mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 08:02:13 +00:00
ci(release): harden postpublish verification
This commit is contained in:
@@ -45,6 +45,7 @@ type WorkflowRunSummary = {
|
||||
|
||||
const DEFAULT_REPO = "openclaw/openclaw";
|
||||
const DEFAULT_CLAWHUB_REGISTRY = "https://clawhub.ai";
|
||||
const CLAWHUB_REQUEST_TIMEOUT_MS = 20_000;
|
||||
|
||||
function isRecord(value: unknown): value is JsonRecord {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
@@ -209,7 +210,10 @@ async function fetchWithRetry(
|
||||
let lastError: unknown;
|
||||
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
||||
try {
|
||||
const response = await fetch(url, options);
|
||||
const response = await fetch(url, {
|
||||
...options,
|
||||
signal: AbortSignal.timeout(CLAWHUB_REQUEST_TIMEOUT_MS),
|
||||
});
|
||||
if (response.status !== 429 && response.status < 500) {
|
||||
return response;
|
||||
}
|
||||
@@ -342,6 +346,7 @@ function verifyWorkflowRun(params: {
|
||||
repo: string;
|
||||
expectedWorkflowName: string;
|
||||
expectedHeadBranch?: string;
|
||||
allowedHeadBranches?: string[];
|
||||
rerunFailed: boolean;
|
||||
}): WorkflowRunSummary {
|
||||
const raw = runCommand("gh", [
|
||||
@@ -370,9 +375,12 @@ function verifyWorkflowRun(params: {
|
||||
);
|
||||
}
|
||||
const headBranch = readString(run.headBranch);
|
||||
if (params.expectedHeadBranch !== undefined && headBranch !== params.expectedHeadBranch) {
|
||||
const allowedHeadBranches =
|
||||
params.allowedHeadBranches ??
|
||||
(params.expectedHeadBranch !== undefined ? [params.expectedHeadBranch] : []);
|
||||
if (allowedHeadBranches.length > 0 && !allowedHeadBranches.includes(headBranch ?? "")) {
|
||||
throw new Error(
|
||||
`${params.label}: run ${params.id} branch is ${headBranch ?? "<missing>"}, expected ${params.expectedHeadBranch}.`,
|
||||
`${params.label}: run ${params.id} branch is ${headBranch ?? "<missing>"}, expected ${allowedHeadBranches.join(" or ")}.`,
|
||||
);
|
||||
}
|
||||
const status = readString(run.status);
|
||||
@@ -519,7 +527,7 @@ export async function verifyBetaRelease(
|
||||
label: "Full Release Validation",
|
||||
repo: args.repo,
|
||||
expectedWorkflowName: "Full Release Validation",
|
||||
expectedHeadBranch: args.workflowRef,
|
||||
allowedHeadBranches: ["main", args.workflowRef],
|
||||
rerunFailed: false,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user