diff --git a/scripts/verify-pr-hosted-gates.mjs b/scripts/verify-pr-hosted-gates.mjs index 032efcbc4830..832fc9aed873 100644 --- a/scripts/verify-pr-hosted-gates.mjs +++ b/scripts/verify-pr-hosted-gates.mjs @@ -20,7 +20,7 @@ const ARTIFACT_FALLBACK_REQUIRED_WORKFLOWS = [ function readOptionValue(argv, index, optionName) { const value = argv[index + 1]; - if (!value || value.startsWith("--")) { + if (!value || value.startsWith("-")) { throw new Error(`Expected ${optionName} .`); } return value; diff --git a/test/scripts/verify-pr-hosted-gates.test.ts b/test/scripts/verify-pr-hosted-gates.test.ts index 8c29b8f4dd42..e2aac1b331aa 100644 --- a/test/scripts/verify-pr-hosted-gates.test.ts +++ b/test/scripts/verify-pr-hosted-gates.test.ts @@ -304,6 +304,22 @@ describe("verify-pr-hosted-gates", () => { changelogOnly: false, }); expect(() => parseArgs(["--repo", "openclaw/openclaw"])).toThrow("Usage:"); + expect(() => + parseArgs(["--repo", "-h", "--sha", sha, "--output", ".local/gates-hosted-checks.json"]), + ).toThrow("Expected --repo ."); + expect(() => + parseArgs([ + "--repo", + "openclaw/openclaw", + "--sha", + "-h", + "--output", + ".local/gates-hosted-checks.json", + ]), + ).toThrow("Expected --sha ."); + expect(() => + parseArgs(["--repo", "openclaw/openclaw", "--sha", sha, "--output", "-h"]), + ).toThrow("Expected --output ."); }); it("accepts JSON emitted through a colorizing GitHub CLI shim", () => {