Skip to content

Commit 09ec90d

Browse files
committed
GH-499: Require PR labels for changelog
1 parent b933d2e commit 09ec90d

File tree

2 files changed

+103
-2
lines changed

2 files changed

+103
-2
lines changed

.github/workflows/dev_pr.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

CONTRIBUTING.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,38 @@ existing Arrow issues in [GitHub](https://github.com/apache/arrow-java/issues).
3030

3131
## Did you write a patch that fixes a bug or brings an improvement?
3232

33-
Create a GitHub issue and submit your changes as a GitHub Pull Request.
34-
Please make sure to [reference the issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) in your PR description.
33+
- Create a GitHub issue and submit your changes as a GitHub Pull Request.
34+
- [Reference the issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) in your PR description.
35+
- Add one or more of the labels "bug-fix", "dependencies", and "enhancement" to your PR as appropriate.
36+
- "bug-fix" is for PRs that fix a bug.
37+
- "dependencies" is for PRs that upgrade a dependency or other administrative work (build system, release process, etc.).
38+
- "enhancement" is for PRs that add new features.
39+
- Add the "breaking-change" label to your PR if there are breaking API changes.
40+
- Add the PR title. The PR title will be used as the eventual commit message, so please make it descriptive but succinct.
41+
42+
Example #1:
43+
44+
```
45+
GH-12345: Document the pull request process
46+
47+
Explain how to open a pull request and what the title, body, and labels should be.
48+
49+
Closes #12345.
50+
51+
Labels: dependencies
52+
```
53+
54+
Example #2:
55+
56+
```
57+
GH-42424: Expose Netty server builder in Flight
58+
59+
Allow direct usage of gRPC APIs for low-level control.
60+
61+
Closes #42424.
62+
63+
Labels: enhancement
64+
```
3565

3666
### Minor Fixes
3767

0 commit comments

Comments
 (0)