Skip to content

Commit

Permalink
apacheGH-499: Require PR labels for changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Feb 7, 2025
1 parent b933d2e commit 992be92
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 2 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/dev_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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: Dev PR

on:
pull_request_target:
types:
- labeled
- unlabeled
- opened
- edited
- reopened
- synchronize
- ready_for_review
- review_requested

concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions:
contents: read

jobs:
pr-label:
name: "Ensure PR format"
runs-on: ubuntu-latest
steps:
- name: Ensure PR is labeled
env:
LABELS: ${{ toJson(github.event.pull_request.labels) }}
run: |
if ! echo "$LABELS" | jq -e '.[] | select(.name | IN("bug-fix", "dependencies", "enhancement")) | .name'; then
echo "Label the PR with one or more of:"
echo "- bug-fix"
echo "- dependencies"
echo "- enhancement"
echo
echo "Also, add 'breaking-change' if appropriate."
exit 1
else
echo "Pull request is labeled properly!"
fi
- name: Ensure PR title format
env:
TITLE: ${{ toJson(github.event.pull_request.title) }}
run: |
set -x
if echo $TITLE | grep --extended-regexp "^MINOR: .*$" >/dev/null; then
echo "This is a MINOR PR."
elif echo $TITLE | grep --extended-regexp "^GH-[0-9]+: .*$" >/dev/null; then
echo "This is a normal PR."
else
echo "PR title format is incorrect. Please see CONTRIBUTING.md."
exit 1
fi
34 changes: 32 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,38 @@ existing Arrow issues in [GitHub](https://github.com/apache/arrow-java/issues).

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

Create a GitHub issue and submit your changes as a GitHub Pull Request.
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.
- Create a GitHub issue and submit your changes as a GitHub Pull Request.
- [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.
- Add one or more of the labels "bug-fix", "dependencies", and "enhancement" to your PR as appropriate.
- "bug-fix" is for PRs that fix a bug.
- "dependencies" is for PRs that upgrade a dependency or other administrative work (build system, release process, etc.).
- "enhancement" is for PRs that add new features.
- Add the "breaking-change" label to your PR if there are breaking API changes.
- Add the PR title. The PR title will be used as the eventual commit message, so please make it descriptive but succinct.

Example #1:

```
GH-12345: Document the pull request process
Explain how to open a pull request and what the title, body, and labels should be.
Closes #12345.
Labels: dependencies
```

Example #2:

```
GH-42424: Expose Netty server builder in Flight
Allow direct usage of gRPC APIs for low-level control.
Closes #42424.
Labels: enhancement
```

### Minor Fixes

Expand Down

0 comments on commit 992be92

Please sign in to comment.