|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | +name: PR Title Check |
| 18 | + |
| 19 | +on: |
| 20 | + pull_request: |
| 21 | + types: [opened, edited, reopened] |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: pr-title-${{ github.event.pull_request.number }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +permissions: {} |
| 28 | + |
| 29 | +jobs: |
| 30 | + check-pr-title: |
| 31 | + runs-on: ubuntu-slim |
| 32 | + steps: |
| 33 | + - name: Check PR Title |
| 34 | + env: |
| 35 | + PR_TITLE: ${{ github.event.pull_request.title }} |
| 36 | + run: | |
| 37 | + PATTERN='^[A-Za-z][A-Za-z0-9._+/&-]*: .+' |
| 38 | + if ! echo "$PR_TITLE" | grep -Eq "$PATTERN"; then |
| 39 | + echo "::error::PR title must follow 'Module: Description' format. Got: '$PR_TITLE'" |
| 40 | + echo "Examples: 'Core: Fix ...', 'Spark: Add ...', 'API: Remove ...', 'Docs: Update ...'" |
| 41 | + exit 1 |
| 42 | + fi |
| 43 | +
|
| 44 | + echo "PR title is valid: '$PR_TITLE'" |
0 commit comments