🌱 replace kubebuilder-release-tools with new workflow #5368
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR verify | |
on: | |
pull_request_target: | |
types: [opened, edited, synchronize, reopened] | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
verify-pr-type: | |
runs-on: ubuntu-latest | |
name: verify PR type | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4.1.7 | |
- name: Check if PR title has acceptable prefix | |
run: | | |
targets=(":sparkles:" ":bug:" ":book:" ":seedling:" ":warning:" ":rocket:" ":running:" "✨" "🐛" "📚" "🌱" "⚠️" "🚀" "🏃") | |
for target in "${targets[@]}"; do | |
if echo '${{ github.event.pull_request.title }}' | grep -o ^$target; then | |
exit 0 | |
fi | |
done | |
cat <<EOF > /tmp/comment | |
I saw a title of ${{ github.event.pull_request.title }}, which doesn't seem to have any of the acceptable prefixes. | |
You need to have one of these as the prefix of your PR title: | |
- Breaking change: ⚠ ("warning") | |
- Non-breaking feature: ✨ ("sparkles") | |
- Patch fix: 🐛 ("bug") | |
- Docs: 📖 ("book") | |
- Release: 🚀 ("rocket") | |
- Infra/Tests/Other: 🌱 ("seedling") | |
EOF | |
gh pr comment ${{ github.event.number }} -F /tmp/comment | |
exit 1 | |
verify-pr-no-issue-number: | |
runs-on: ubuntu-latest | |
name: verify PR no issue number | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4.1.7 | |
- name: Check if there is no Issue or PR number | |
run: | | |
if echo '${{ github.event.pull_request.title }}' | grep -o -E -v '#[0-9]+'; then | |
exit 0 | |
fi | |
cat <<EOF > /tmp/comment | |
The title should just be descriptive. | |
Issue numbers belong in the PR body as either "Fixes #XYZ" (if it closes the issue or PR), or something like "Related to #XYZ" (if it's just related). | |
EOF | |
gh pr comment ${{ github.event.number }} -F /tmp/comment | |
exit 1 | |