🌱 Replace deprecated kubebuilder-release-tools PR verifier with inline script

The Docker image gcr.io/kubebuilder/pr-verifier:v0.4.3 used by
kubernetes-sigs/kubebuilder-release-tools has been removed from GCR
as of March 2025. Replace it with an inline shell script that validates
PR title format, following the approach adopted by the Kubebuilder
project itself.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Zhiwei Yin <zyin@redhat.com>
This commit is contained in:
Zhiwei Yin
2026-03-09 10:32:17 +08:00
parent 4a46af2145
commit e65b65b490

View File

@@ -1,11 +1,7 @@
name: PR Verifier
on:
# NB: using `pull_request_target` runs this in the context of
# the base repository, so it has permission to upload to the checks API.
# This means changes won't kick in to this file until merged onto the
# main branch.
pull_request_target:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions:
@@ -14,13 +10,27 @@ permissions:
jobs:
verify:
name: verify PR contents
permissions:
checks: write
pull-requests: read
runs-on: ubuntu-latest
steps:
- name: Verifier action
id: verifier
uses: kubernetes-sigs/kubebuilder-release-tools@v0.4.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ -z "$TITLE" ]]; then
echo "Error: PR title cannot be empty."
exit 1
fi
if ! [[ "$TITLE" =~ ^($'\u26A0'|$'\u2728'|$'\U0001F41B'|$'\U0001F4D6'|$'\U0001F680'|$'\U0001F331') ]]; then
echo "Error: Invalid PR title format."
echo "Your PR title must start with one of the following indicators:"
echo "- Breaking change: ⚠ (U+26A0)"
echo "- Non-breaking feature: ✨ (U+2728)"
echo "- Patch fix: 🐛 (U+1F41B)"
echo "- Docs: 📖 (U+1F4D6)"
echo "- Release: 🚀 (U+1F680)"
echo "- Infra/Tests/Other: 🌱 (U+1F331)"
exit 1
fi
echo "PR title is valid: '$TITLE'"