|
| 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 | + |
| 18 | +name: Dev PR |
| 19 | + |
| 20 | +on: |
| 21 | + pull_request_target: |
| 22 | + types: |
| 23 | + - labeled |
| 24 | + - unlabeled |
| 25 | + - opened |
| 26 | + - edited |
| 27 | + - reopened |
| 28 | + - synchronize |
| 29 | + - ready_for_review |
| 30 | + - review_requested |
| 31 | + |
| 32 | +concurrency: |
| 33 | + group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }} |
| 34 | + cancel-in-progress: true |
| 35 | + |
| 36 | +permissions: |
| 37 | + contents: read |
| 38 | + |
| 39 | +jobs: |
| 40 | + pr-label: |
| 41 | + name: "Ensure PR format" |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - name: Ensure PR is labeled |
| 45 | + env: |
| 46 | + LABELS: ${{ toJson(github.event.pull_request.labels) }} |
| 47 | + run: | |
| 48 | + if ! echo "$LABELS" | jq -e '.[] | select(.name | IN("bug-fix", "dependencies", "enhancement")) | .name'; then |
| 49 | + echo "Label the PR with one or more of:" |
| 50 | + echo "- bug-fix" |
| 51 | + echo "- dependencies" |
| 52 | + echo "- enhancement" |
| 53 | + echo |
| 54 | + echo "Also, add 'breaking-change' if appropriate." |
| 55 | + exit 1 |
| 56 | + else |
| 57 | + echo "Pull request is labeled properly!" |
| 58 | + fi |
| 59 | +
|
| 60 | + - name: Ensure PR title format |
| 61 | + env: |
| 62 | + TITLE: ${{ toJson(github.event.pull_request.title) }} |
| 63 | + run: | |
| 64 | + if echo "$TITLE" | grep --extended-regexp "^MINOR: .*$" >/dev/null; then |
| 65 | + echo "This is a MINOR PR." |
| 66 | + elif echo "$TITLE" | grep --extended-regexp "^GH-[0-9]+: .*$" >/dev/null; then |
| 67 | + echo "This is a normal PR." |
| 68 | + else |
| 69 | + echo "PR title format is incorrect. Please see CONTRIBUTING.md." |
| 70 | + exit 1 |
| 71 | + fi |
0 commit comments