Skip to content

Commit

Permalink
ci: Add automated check for PR title formatting (#17412)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Jul 4, 2024
1 parent 1146993 commit dd1ca84
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"LABEL": {
"name": "title needs formatting",
"color": "FF0000"
},
"CHECKS": {
"regexp": "^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)(\\((python|rust)\\!?(,(python|rust)\\!?)?\\))?\\!?\\: [A-Z].*[^\\.\\!\\?,… ]$",
"ignoreLabels": ["skip changelog"]
},
"MESSAGES": {
"success": "PR title OK!",
"failure": "Invalid PR title! Please update according to the contributing guidelines: https://docs.pola.rs/development/contributing/#pull-requests",
"notice": ""
}
}
7 changes: 6 additions & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ permissions:
pull-requests: write

jobs:
main:
labeler:
runs-on: ubuntu-latest
steps:
- name: Check pull request title
uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Label pull request
uses: release-drafter/release-drafter@v6
with:
Expand Down
18 changes: 14 additions & 4 deletions docs/development/contributing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,20 @@ Two other things to keep in mind:
When you have resolved your issue, [open a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) in the Polars repository.
Please adhere to the following guidelines:

- Start your pull request title with a [conventional commit](https://www.conventionalcommits.org/) tag. This helps us add your contribution to the right section of the changelog. We use the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type). Scope can be `rust` and/or `python`, depending on your contribution.
- Use a descriptive title starting with an uppercase letter. This text will end up in the [changelog](https://github.com/pola-rs/polars/releases).
- In the pull request description, [link](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) to the issue you were working on.
- Add any relevant information to the description that you think may help the maintainers review your code.
- Title
- Start your pull request title with a [conventional commit](https://www.conventionalcommits.org/) tag.
This helps us add your contribution to the right section of the changelog.
We use the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type).
Scope can be `rust` and/or `python`, depending on your contribution: this tag determines which changelog(s) will include your change.
Omit the scope if your change affects both Rust and Python.
- Use a descriptive title starting with an uppercase letter.
This text will end up in the [changelog](https://github.com/pola-rs/polars/releases), so make sure the text is meaningful to the user.
Use single backticks to annotate code snippets.
Use active language and do not end your title with punctuation.
- Example: ``fix(python): Fix `DataFrame.top_k` not handling nulls correctly``
- Description
- In the pull request description, [link](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) to the issue you were working on.
- Add any relevant information to the description that you think may help the maintainers review your code.
- Make sure your branch is [rebased](https://docs.github.com/en/get-started/using-git/about-git-rebase) against the latest version of the `main` branch.
- Make sure all [GitHub Actions checks](./ci.md) pass.

Expand Down

0 comments on commit dd1ca84

Please sign in to comment.