From ac61579c368caec54bfcf2193a8b2449099b0600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Wed, 11 Dec 2024 11:01:19 +0100 Subject: [PATCH] chore(ci): add Github labels based on PR title (#2914) * chore: add security as valid convention PR title * chore: add labels based on PR title * docs: document the existing conventions for commits categories * fix: follow convention for breaking changes * chore: capture breaking changes in the different sections when adding labels * chore: do not admit uppercase types * dix: do not admit bug as type * docs: remove breaking from the contributing guide --- .github/release-drafter.yml | 22 ++++++++++++++++++++++ .github/workflows/conventions.yml | 6 +++--- .github/workflows/release-drafter.yml | 6 ++++++ docs/contributing.md | 9 ++++++++- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 1fe773fb46..2e5efff2b1 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -26,3 +26,25 @@ categories: - 'test flakiness' - title: 📦 Dependency updates label: 'dependencies' +autolabeler: + - label: 'breaking change' + title: + - '/^[a-z]+(\(.+\))?!\:/' + - label: 'security' + title: + - '/^security(\(.+\))?!?\:/' + - label: 'feature' + title: + - '/^feat(\(.+\))?!?\:/' + - label: 'bug' + title: + - '/^(fix)(\(.+\))?!?\:/' + - label: 'documentation' + title: + - '/^docs(\(.+\))?!?\:/' + - label: 'chore' + title: + - '/^chore(\(.+\))?!?\:/' + - label: 'dependencies' + title: + - '/^deps(\(.+\))?!?\:/' diff --git a/.github/workflows/conventions.yml b/.github/workflows/conventions.yml index 9821e904c8..ef858a42b6 100644 --- a/.github/workflows/conventions.yml +++ b/.github/workflows/conventions.yml @@ -22,13 +22,14 @@ jobs: with: # We may not need a scope on every commit (i.e. repo-level change). # + # feat!: read config consistenly # feat(redis): support for clustering # chore(redis): update tests # fix(redis): trim connection string # ^ ^ ^ # | | |__ Subject # | |_______ Scope - # |____________ Type + # |____________ Type: it can end with a ! to denote a breaking change. requireScope: false # Scope should be lowercase. disallowScopes: | @@ -40,10 +41,9 @@ jobs: didn't match the configured pattern. Please ensure that the subject doesn't start with an uppercase character. types: | - break + security fix feat - bug docs chore deps diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 7bab45a5aa..43cb9ad9d2 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -5,6 +5,10 @@ on: push: branches: - main + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] permissions: contents: read @@ -17,5 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v5.19.0 + with: + disable-autolabeler: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/contributing.md b/docs/contributing.md index 617b724b11..5bc9802e4f 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -29,12 +29,19 @@ Please just be sure to: * follow the style, naming and structure conventions of the rest of the project. * make commits atomic and easy to merge. * use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for the PR title. This will help us to understand the nature of the changes, and to generate the changelog after all the commits in the PR are squashed. + * Please use the `feat!`, `chore!`, `fix!`... types for breaking changes, as these categories are considered as `breaking change` in the changelog. Please use the `!` to denote a breaking change. + * Please use the `security` type for security fixes, as these categories are considered as `security` in the changelog. + * Please use the `feat` type for new features, as these categories are considered as `feature` in the changelog. + * Please use the `fix` type for bug fixes, as these categories are considered as `bug` in the changelog. + * Please use the `docs` type for documentation updates, as these categories are considered as `documentation` in the changelog. + * Please use the `chore` type for housekeeping commits, including `build`, `ci`, `style`, `refactor`, `test`, `perf` and so on, as these categories are considered as `chore` in the changelog. + * Please use the `deps` type for dependency updates, as these categories are considered as `dependencies` in the changelog. !!!important There is a GitHub Actions workflow that will check if your PR title follows the conventional commits convention. If not, it contributes a failed check to your PR. To know more about the conventions, please refer to the [workflow file](https://github.com/testcontainers/testcontainers-go/blob/main/.github/workflows/conventions.yml). -* use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages, as it improves the readability of the commit history, and the review process. +* use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages, as it improves the readability of the commit history, and the review process. Please follow the above conventions for the PR title. * unless necessary, please try to **avoid pushing --force** to the published branch you submitted a PR from, as it makes it harder to review the changes from a given previous state. * apply format running `make lint-all`. It will run `golangci-lint` for the core and modules with the configuration set in the root directory of the project. Please be aware that the lint stage on CI could fail if this is not done. * For linting just the modules: `make -C modules lint-modules`