Skip to content

Commit 55adb60

Browse files
authored
fix(release): avoid npm publish timeout on prior beta selector (#124080)
* fix(release): avoid prior beta selector fetch timeout * fix(ci): repair test typecheck and UI lint
1 parent 17df3f6 commit 55adb60

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,11 +1200,7 @@ jobs:
12001200
fi
12011201
current_selector_version="$(npm view "openclaw@${RELEASE_NPM_DIST_TAG}" version)"
12021202
current_selector_ref="v${current_selector_version}"
1203-
if ! git rev-parse --verify "${current_selector_ref}^{commit}" >/dev/null 2>&1; then
1204-
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags origin \
1205-
"refs/tags/${current_selector_ref}:refs/tags/${current_selector_ref}"
1206-
fi
1207-
current_selector_sha="$(git rev-parse "${current_selector_ref}^{commit}")"
1203+
current_selector_sha="$(git -C trusted-workflow rev-parse --verify "refs/tags/${current_selector_ref}^{commit}")"
12081204
node trusted-workflow/scripts/plugin-sdk-api-release-evidence.mjs \
12091205
--manifest "$MANIFEST_FILE" \
12101206
--head "$EXPECTED_RELEASE_SHA" \

‎test/scripts/openclaw-npm-extended-stable-workflow.test.ts‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("minimal npm extended-stable workflow", () => {
5757
const gitFetchLines = source
5858
.split("\n")
5959
.filter((line) => /\bgit(?: -C "[^"]+")? fetch\b/u.test(line));
60-
expect(gitFetchLines).toHaveLength(9);
60+
expect(gitFetchLines).toHaveLength(8);
6161
expect(
6262
gitFetchLines.every((line) => line.includes("timeout --signal=TERM --kill-after=10s 120s")),
6363
).toBe(true);
@@ -119,6 +119,10 @@ describe("minimal npm extended-stable workflow", () => {
119119
parsed.jobs?.preflight_openclaw_npm,
120120
"Checkout trusted Plugin SDK API tooling",
121121
);
122+
const publishProvenanceRun = publishProvenance.run;
123+
if (!publishProvenanceRun) {
124+
throw new Error("Verify prepared tarball provenance is missing its run script");
125+
}
122126

123127
expect(input).toEqual({
124128
default: "",
@@ -141,18 +145,29 @@ describe("minimal npm extended-stable workflow", () => {
141145
expect(preflightDiff.run).toContain('git -C "$tooling_dir" status --porcelain');
142146
expect(preflightDiff.run).not.toContain('pkg.scripts?.["plugin-sdk:api:diff"]');
143147
expect(preflightDiff.run).toContain('pnpm --dir "$tooling_dir" run plugin-sdk:api:diff');
144-
expect(publishProvenance.run).toContain("plugin-sdk-api-release-evidence.mjs");
145-
expect(publishProvenance.run).toContain('--acknowledge "$PLUGIN_SDK_API_ACKNOWLEDGEMENT"');
146-
expect(publishProvenance.run).toContain('npm view "openclaw@${RELEASE_NPM_DIST_TAG}" version');
147-
expect(publishProvenance.run).toContain('--current-selector-ref "$current_selector_ref"');
148-
expect(publishProvenance.run).toContain('--current-selector-sha "$current_selector_sha"');
149-
expect(publishProvenance.run).toContain('--workflow-sha "$PREFLIGHT_WORKFLOW_SHA"');
148+
expect(publishProvenanceRun).toContain("plugin-sdk-api-release-evidence.mjs");
149+
expect(publishProvenanceRun).toContain('--acknowledge "$PLUGIN_SDK_API_ACKNOWLEDGEMENT"');
150+
expect(publishProvenanceRun).toContain('npm view "openclaw@${RELEASE_NPM_DIST_TAG}" version');
151+
expect(publishProvenanceRun).toContain(
152+
'git -C trusted-workflow rev-parse --verify "refs/tags/${current_selector_ref}^{commit}"',
153+
);
154+
expect(publishProvenanceRun).not.toContain("git fetch");
155+
expect(publishProvenanceRun).toContain('--current-selector-ref "$current_selector_ref"');
156+
expect(publishProvenanceRun).toContain('--current-selector-sha "$current_selector_sha"');
157+
expect(publishProvenanceRun).toContain('--workflow-sha "$PREFLIGHT_WORKFLOW_SHA"');
150158
expect(downloadPreflight.run).toContain(
151159
'"plugin-sdk-api-release-diff-${PREFLIGHT_RUN_ID}-${PREFLIGHT_RUN_ATTEMPT}"',
152160
);
153-
expect(publishProvenance.run).toContain(
161+
expect(publishProvenanceRun).toContain(
154162
"Prepared Plugin SDK API evidence does not match its immutable artifact",
155163
);
164+
expect(
165+
publishProvenanceRun.indexOf(
166+
"Prepared Plugin SDK API evidence does not match its immutable artifact",
167+
),
168+
).toBeLessThan(
169+
publishProvenanceRun.indexOf('npm view "openclaw@${RELEASE_NPM_DIST_TAG}" version'),
170+
);
156171
expect(verifyPreflightRun.run).toContain(
157172
'"$preflight_head_branch" == "$EXPECTED_EXTENDED_STABLE_BRANCH"',
158173
);

0 commit comments

Comments
 (0)