From dcb7e50ad3e426c3afaececb04710bb50ecae5cb Mon Sep 17 00:00:00 2001 From: Manu Zhang Date: Fri, 24 Apr 2026 23:17:47 +0800 Subject: [PATCH 1/3] CI: Add PR title check workflow --- .github/workflows/pr-title-check.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/pr-title-check.yml diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 000000000000..aed61e6c2b74 --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,41 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +name: PR Title Check + +on: + pull_request: + types: [opened, edited, reopened] + +permissions: + contents: read + pull-requests: read + +jobs: + check-pr-title: + runs-on: ubuntu-latest + steps: + - name: Check PR Title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + if ! echo $PR_TITLE | grep -Eq '^[A-Za-z][A-Za-z0-9 ._+/&-]*: .+'; then + echo "Invalid PR title: '$PR_TITLE'" + echo "PR titles must follow 'Module: Description' (example: 'Core: Fix manifest reuse in scan planning')." + exit 1 + fi + + echo "PR title is valid: '$PR_TITLE'" From 4c7f41fe63dc67ad754ffb70afa7e318597cb2b1 Mon Sep 17 00:00:00 2001 From: Manu Zhang Date: Sat, 9 May 2026 21:29:19 +0800 Subject: [PATCH 2/3] Update .github/workflows/pr-title-check.yml Co-authored-by: Kevin Liu --- .github/workflows/pr-title-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index aed61e6c2b74..381daeaeda09 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -32,7 +32,7 @@ jobs: env: PR_TITLE: ${{ github.event.pull_request.title }} run: | - if ! echo $PR_TITLE | grep -Eq '^[A-Za-z][A-Za-z0-9 ._+/&-]*: .+'; then + if ! echo "$PR_TITLE" | grep -Eq '^[A-Za-z][A-Za-z0-9 ._+/&-]*: .+'; then echo "Invalid PR title: '$PR_TITLE'" echo "PR titles must follow 'Module: Description' (example: 'Core: Fix manifest reuse in scan planning')." exit 1 From 6cb3e6f039d17826d761b01f451937d63bf14875 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Sat, 9 May 2026 10:09:52 -0700 Subject: [PATCH 3/3] code review Co-authored-by: Copilot --- .github/workflows/pr-title-check.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 381daeaeda09..48c4b652ce2b 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -20,21 +20,24 @@ on: pull_request: types: [opened, edited, reopened] -permissions: - contents: read - pull-requests: read +concurrency: + group: pr-title-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: {} jobs: check-pr-title: - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Check PR Title env: PR_TITLE: ${{ github.event.pull_request.title }} run: | - if ! echo "$PR_TITLE" | grep -Eq '^[A-Za-z][A-Za-z0-9 ._+/&-]*: .+'; then - echo "Invalid PR title: '$PR_TITLE'" - echo "PR titles must follow 'Module: Description' (example: 'Core: Fix manifest reuse in scan planning')." + PATTERN='^[A-Za-z][A-Za-z0-9._+/&-]*: .+' + if ! echo "$PR_TITLE" | grep -Eq "$PATTERN"; then + echo "::error::PR title must follow 'Module: Description' format. Got: '$PR_TITLE'" + echo "Examples: 'Core: Fix ...', 'Spark: Add ...', 'API: Remove ...', 'Docs: Update ...'" exit 1 fi