From 1d95782f510beeeae9a47c05130636fb95196997 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:34:01 +0100 Subject: [PATCH 1/2] fix(ci): pr title check --- .github/workflows/pr-title.yaml | 37 +++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-title.yaml b/.github/workflows/pr-title.yaml index 87d54f59ba..6debd4f529 100644 --- a/.github/workflows/pr-title.yaml +++ b/.github/workflows/pr-title.yaml @@ -7,7 +7,36 @@ jobs: runs-on: ubuntu-latest name: Verify PR title steps: - - name: Verify PR title - uses: kubernetes-sigs/kubebuilder-release-tools@v0.4.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Verify PR title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + EMOJI_WARNING=$'\u26A0' + EMOJI_SPARKLES=$'\u2728' + EMOJI_BUG=$'\U0001F41B' + EMOJI_BOOK=$'\U0001F4D6' + EMOJI_SEEDLING=$'\U0001F331' + + # Normalize GitHub-style emoji shortcodes to actual emojis + title=$(echo "$PR_TITLE" | sed -E "s/:warning:/${EMOJI_WARNING}/g; s/:sparkles:/${EMOJI_SPARKLES}/g; s/:bug:/${EMOJI_BUG}/g; s/:book:/${EMOJI_BOOK}/g; s/:seedling:/${EMOJI_SEEDLING}/g") + + # Check PR type prefix + if ! [[ "$title" =~ ^(${EMOJI_WARNING}|${EMOJI_SPARKLES}|${EMOJI_BUG}|${EMOJI_BOOK}|${EMOJI_SEEDLING}) ]]; then + echo "Error: No matching PR type indicator found in title." + echo "You need to have one of these as the prefix of your PR title:" + echo "- Breaking change: ${EMOJI_WARNING} (:warning:)" + echo "- Non-breaking feature: ${EMOJI_SPARKLES} (:sparkles:)" + echo "- Patch fix: ${EMOJI_BUG} (:bug:)" + echo "- Docs: ${EMOJI_BOOK} (:book:)" + echo "- Infra/Tests/Other: ${EMOJI_SEEDLING} (:seedling:)" + exit 1 + fi + + # Check that PR title does not contain issue or PR number + if [[ "$title" =~ \#[0-9]+ ]]; then + echo "Error: PR title should not contain issue or PR number." + echo "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)." + exit 1 + fi + + echo "PR title is valid: $title" From 079b3a4791863f208f7c3b6342903e37dad5e2e5 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:52:33 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/pr-title.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-title.yaml b/.github/workflows/pr-title.yaml index 6debd4f529..f899d9f238 100644 --- a/.github/workflows/pr-title.yaml +++ b/.github/workflows/pr-title.yaml @@ -6,8 +6,12 @@ jobs: pr-title: runs-on: ubuntu-latest name: Verify PR title + permissions: + contents: read + pull-requests: read steps: - name: Verify PR title + shell: bash env: PR_TITLE: ${{ github.event.pull_request.title }} run: | @@ -18,7 +22,7 @@ jobs: EMOJI_SEEDLING=$'\U0001F331' # Normalize GitHub-style emoji shortcodes to actual emojis - title=$(echo "$PR_TITLE" | sed -E "s/:warning:/${EMOJI_WARNING}/g; s/:sparkles:/${EMOJI_SPARKLES}/g; s/:bug:/${EMOJI_BUG}/g; s/:book:/${EMOJI_BOOK}/g; s/:seedling:/${EMOJI_SEEDLING}/g") + title=$(sed -E "s/:warning:/${EMOJI_WARNING}/g; s/:sparkles:/${EMOJI_SPARKLES}/g; s/:bug:/${EMOJI_BUG}/g; s/:book:/${EMOJI_BOOK}/g; s/:seedling:/${EMOJI_SEEDLING}/g" <<<"$PR_TITLE") # Check PR type prefix if ! [[ "$title" =~ ^(${EMOJI_WARNING}|${EMOJI_SPARKLES}|${EMOJI_BUG}|${EMOJI_BOOK}|${EMOJI_SEEDLING}) ]]; then