fix(ci): bound Mantis Discord fetches (#110851)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
mikasa
2026-07-29 11:36:27 +08:00
committed by GitHub
parent ede8fe33df
commit 887b37cf80
2 changed files with 16 additions and 2 deletions
+2 -2
View File
@@ -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"
+14
View File
@@ -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;