diff --git a/.github/workflows/mantis-discord-smoke.yml b/.github/workflows/mantis-discord-smoke.yml index bed7e0f3e4bf..e36a7e688c24 100644 --- a/.github/workflows/mantis-discord-smoke.yml +++ b/.github/workflows/mantis-discord-smoke.yml @@ -85,14 +85,14 @@ jobs: selected_revision="$(git rev-parse HEAD)" trusted_reason="" - git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main + timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main if git merge-base --is-ancestor "$selected_revision" refs/remotes/origin/main; then trusted_reason="main-ancestor" elif git tag --points-at "$selected_revision" | grep -Eq '^v'; then trusted_reason="release-tag" elif [[ "$INPUT_REF" =~ ^release/[0-9]{4}\.[0-9]+\.[0-9]+$ ]]; then - git fetch --no-tags origin "+refs/heads/${INPUT_REF}:refs/remotes/origin/${INPUT_REF}" + timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags origin "+refs/heads/${INPUT_REF}:refs/remotes/origin/${INPUT_REF}" release_branch_sha="$(git rev-parse "refs/remotes/origin/${INPUT_REF}")" if [[ "$selected_revision" == "$release_branch_sha" ]]; then trusted_reason="release-branch-head" diff --git a/test/scripts/ci-workflow-guards.test.ts b/test/scripts/ci-workflow-guards.test.ts index bebc518ee71c..c96f44f38934 100644 --- a/test/scripts/ci-workflow-guards.test.ts +++ b/test/scripts/ci-workflow-guards.test.ts @@ -3240,6 +3240,20 @@ describe("ci workflow guards", () => { } }); + it("bounds mantis discord smoke validation git fetches", () => { + const workflowPath = ".github/workflows/mantis-discord-smoke.yml"; + const source = readFileSync(workflowPath, "utf8"); + const gitFetchLines = source.split("\n").filter((line) => line.includes("git fetch")); + + expect(gitFetchLines, workflowPath).toHaveLength(2); + expect( + gitFetchLines.every((line) => + line.trimStart().startsWith("timeout --signal=TERM --kill-after=10s 120s git fetch"), + ), + workflowPath, + ).toBe(true); + }); + it("bounds release ref validation fetches across checkout auth modes", () => { const resolveTargetSteps = readReleaseChecksWorkflow().jobs.resolve_target.steps;