From 7c3c4c899e87a3f8abed804b8a03b8e47375cd84 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Thu, 3 Dec 2026 11:29:00 -0800 Subject: [PATCH] ci: preserve policy self-exclusion at the root path --- .github/block/scripts/block-ci-port-test.py | 8 ++++++++ .github/block/scripts/public-text-check.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/block/scripts/block-ci-port-test.py b/.github/block/scripts/block-ci-port-test.py index 1d0632db09..8b5d6e1c5b 100644 --- a/.github/block/scripts/block-ci-port-test.py +++ b/.github/block/scripts/block-ci-port-test.py @@ -86,6 +86,14 @@ class PortTests(unittest.TestCase): control_head = git("rev-parse", "HEAD").decode().strip() self.assertIn(b".github/workflows/block-test.yml\0", run("post-merge-review-changed.sh", docs, control_head)) self.assertTrue(run("docs-only-scope.sh", base, control_head).startswith(b"run ")) + checker = root / ".github/block/scripts/public-text-check.sh" + checker.parent.mkdir(parents=True) + checker.write_text("pattern='disk" + "station'\n") + git("add", ".github"); git("commit", "-m", "checker pattern") + pattern_head = git("rev-parse", "HEAD").decode().strip() + title, body = root / "title.txt", root / "body.txt" + title.write_text("CI scope"); body.write_text("Checker patterns") + self.assertEqual(run("public-text-check.sh", control_head, pattern_head, str(title), str(body)), b"public-text: clean\n") def test_safe_merge_refuses_wrong_head_base_and_incomplete_jobs(self): diff --git a/.github/block/scripts/public-text-check.sh b/.github/block/scripts/public-text-check.sh index 6bf18302ab..a9bc036158 100644 --- a/.github/block/scripts/public-text-check.sh +++ b/.github/block/scripts/public-text-check.sh @@ -32,7 +32,7 @@ report() { # report WHERE < matching lines git diff --relative --no-color --no-renames -U0 "$mb" "$head" -- . \ ':(exclude).github/scripts/public-text-check.sh' ':(exclude).github/scripts/public-text-check-test.sh' if [ -n "$(git rev-parse --show-prefix)" ]; then - git -C "$(git rev-parse --show-toplevel)" diff --no-color --no-renames -U0 "$mb" "$head" -- '.github/workflows/block-*.yml' '.github/dockerfiles/block-*.Dockerfile' '.github/block/**' + git -C "$(git rev-parse --show-toplevel)" diff --no-color --no-renames -U0 "$mb" "$head" -- '.github/workflows/block-*.yml' '.github/dockerfiles/block-*.Dockerfile' '.github/block/**' ':(exclude).github/block/scripts/public-text-check.sh' fi } | awk '