From 80099ca82996ab16a193f0853cef61d157fa249f Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Thu, 4 Jul 2024 00:27:38 +0200 Subject: [PATCH 1/2] Add PR title checker --- .github/pr-title-checker-config.json | 15 +++++++++++++++ .github/workflows/pr-labeler.yml | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/pr-title-checker-config.json diff --git a/.github/pr-title-checker-config.json b/.github/pr-title-checker-config.json new file mode 100644 index 000000000000..65f09d5aab9d --- /dev/null +++ b/.github/pr-title-checker-config.json @@ -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": "" + } +} diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 7c9be45095fe..a0c7e83bfdb3 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -9,9 +9,14 @@ permissions: pull-requests: write jobs: - main: + labeler: runs-on: ubuntu-latest steps: + - name: Check pull request title + uses: thehanimo/pr-title-checker@v1.4.2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Label pull request uses: release-drafter/release-drafter@v6 with: From 16a57806e7769b99bd35be4ae2e29870864b1d59 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Thu, 4 Jul 2024 00:46:17 +0200 Subject: [PATCH 2/2] More extensive guidance on PR title guidelines --- docs/development/contributing/index.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/development/contributing/index.md b/docs/development/contributing/index.md index 52ef891c3855..6758a6d79301 100644 --- a/docs/development/contributing/index.md +++ b/docs/development/contributing/index.md @@ -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.