block-ci: refuse host files in a labelled PR outside the allow list

Host paths went through the module allow list, where "*_test.go", "*.md"
and "docs/*" also match root files, so a labelled PR changing
weed/example_test.go or README.md passed. List host changes separately
and fail on any of them; the module list still runs. The port test now
runs the step in a scratch repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 04:31:01 -08:00
1 parent 27f97dd6d1
commit 7c31672e4a
2 files changed
+40 -7

No files matched your search

+10 -6
View File
@@ -82,13 +82,17 @@ jobs:
set -euo pipefail
bash .github/scripts/post-merge-review-check-test.sh
git -c fetch.fsckObjects=true fetch --no-tags origin "+refs/pull/${PR}/head:refs/remotes/pr/head"
{
bash ../.github/block/scripts/post-merge-review-changed.sh "$BASE" "$HEAD"
# Host files keep their root path, so the allow list refuses them.
git -C .. diff -z --name-status --no-renames "$BASE...$HEAD" -- . ':(exclude)seaweed-block/' \
':(exclude).github/workflows/block-*.yml' ':(exclude).github/dockerfiles/block-*.Dockerfile' ':(exclude).github/block/**'
} >changed.bin
bash ../.github/block/scripts/post-merge-review-changed.sh "$BASE" "$HEAD" >changed.bin
# The allow list speaks for the module only: any host file keeps the full review.
git -C .. diff -z --name-only --no-renames "$BASE...$HEAD" -- . ':(exclude)seaweed-block/' \
':(exclude).github/workflows/block-*.yml' ':(exclude).github/dockerfiles/block-*.Dockerfile' ':(exclude).github/block/**' >host.bin
host=0
while IFS= read -r -d '' path; do
printf 'DENY host %q (outside seaweed-block)\n' "$path"
host=1
done <host.bin
bash .github/scripts/post-merge-review-check.sh .github/post-merge-review-allow.txt <changed.bin
exit "$host"
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in