fix(ci): resolve performance target refs before checkout

This commit is contained in:
Vincent Koc
2026-06-24 09:38:23 +08:00
parent 20a87e17f5
commit d4c151844a
2 changed files with 46 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ const WORKFLOW = ".github/workflows/openclaw-performance.yml";
type WorkflowStep = {
name?: string;
id?: string;
if?: string;
run?: string;
env?: Record<string, string>;
@@ -51,6 +52,22 @@ describe("OpenClaw performance workflow", () => {
expect(workflow).toContain(`inputs.kova_ref || '${kovaRef}'`);
});
it("resolves dispatch target refs before checkout", () => {
const resolveTarget = findStep("Resolve OpenClaw target ref");
const checkout = findStep("Checkout OpenClaw");
expect(resolveTarget.id).toBe("target");
expect(resolveTarget.if).toBe("steps.lane.outputs.run == 'true'");
expect(resolveTarget.env?.GH_TOKEN).toBe("${{ github.token }}");
expect(resolveTarget.env?.TARGET_REF_INPUT).toBe("${{ inputs.target_ref }}");
expect(resolveTarget.run).toContain("encodeURIComponent");
expect(resolveTarget.run).toContain(
'gh api "repos/${GITHUB_REPOSITORY}/commits/${encoded_ref}"',
);
expect(resolveTarget.run).toContain("checkout_ref=${resolved_sha}");
expect(checkout.with?.ref).toBe("${{ steps.target.outputs.checkout_ref }}");
});
it("uses the clawgrit reports token for every report repo push path", () => {
const prepare = findStep("Prepare clawgrit reports checkout");
const publish = findStep("Publish to clawgrit reports");