| # |
| # 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: InLong Check Pull Request Title |
| |
| on: |
| pull_request_target: |
| types: |
| - opened |
| - reopened |
| - edited |
| - synchronize |
| |
| jobs: |
| check: |
| name: Check pull request title |
| runs-on: ubuntu-22.04 |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v3 |
| |
| # The correct title should start with [WIP] or [INLONG-xxx], |
| # where xxx is the issue number, e.g. [INLONG-123]. |
| - name: Check title |
| if: ${{ github.event_name == 'pull_request_target' }} |
| run: | |
| if [[ ! "$PR_TITLE" =~ ^\[(WIP|INLONG-[0-9]+)\]\[[a-zA-Z]+\].*$ ]]; then |
| echo "This pull request title is not valid." |
| echo "Title Example: [INLONG-XYZ][Component] Title of the pull request" |
| echo "XYZ should be replaced by the actual GitHub Issue number, e.g. [INLONG-123]" |
| echo "Component should be replaced by the InLong component name, e.g. [INLONG-123][Manager]" |
| |
| # add a job summary |
| echo "## This pull request title is not valid! :bug:" >> $GITHUB_STEP_SUMMARY |
| echo "Title Example: \`[INLONG-XYZ][Component] Title of the pull request\`" >> $GITHUB_STEP_SUMMARY |
| echo "> - **XYZ** should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number, e.g. \`[INLONG-123]\`" >> $GITHUB_STEP_SUMMARY |
| echo "> - **Component** should be replaced by the InLong component name, e.g. \`[INLONG-123][Manager]\`" >> $GITHUB_STEP_SUMMARY |
| |
| exit 1 |
| fi |
| env: |
| PR_TITLE: ${{ github.event.pull_request.title }} |