From 027ef12207dc1295a2871a7e1c072c4b6b6d3e5d Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 4 Sep 2023 14:42:28 +0100 Subject: [PATCH 1/3] Exclude anything but categorised labels, add autolabeler --- .github/release-drafter.yml | 34 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 8 ++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6ca7d3a..e3b3d43 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -11,10 +11,44 @@ categories: - 'kind/dependencies' - 'kind/project' +# Needs to contain all labels from above +include-labels: + - 'kind/enhancement' + - 'kind/bug' + - 'kind/chore' + - 'kind/dependencies' + - 'kind/project' + change-template: '- $TITLE (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. tag-template: 'v$RESOLVED_VERSION' name-template: 'v$RESOLVED_VERSION 🌈' +autolabeler: + - label: 'kind/chore' + branch: + - '/chore\/.+/' + title: + - '/\[chore\]/i' + - label: 'kind/dependencies' + branch: + - '/dependencies\/.+/' + title: + - '/\[dependencies\]/i' + - label: 'kind/project' + branch: + - '/project\/.+/' + title: + - '/\[project\]/i' + - label: 'kind/bug' + branch: + - '/fix\/.+/' + title: + - '/\[fix\]/i' + - label: 'kind/enhancement' + branch: + - '/feature\/.+/' + title: + - '/\[feature\]/i' template: | # What's Changed diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index be1c7c9..3318d56 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -6,7 +6,13 @@ on: # branches to consider in the event; optional, defaults to all 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] + # pull_request_target event is required for autolabeler to support PRs from forks + pull_request_target: + types: [opened, reopened, synchronize] jobs: update_release_draft: runs-on: ubuntu-20.04 From b6c86935cb8805ea82f75d5454944b325a370a3c Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 4 Sep 2023 14:45:33 +0100 Subject: [PATCH 2/3] permissions --- .github/workflows/release-drafter.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 3318d56..763f680 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -12,13 +12,24 @@ on: types: [opened, reopened, synchronize] # pull_request_target event is required for autolabeler to support PRs from forks pull_request_target: - types: [opened, reopened, synchronize] + types: [opened, reopened, synchronize] + +permissions: + contents: read + jobs: update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write runs-on: ubuntu-20.04 steps: - uses: release-drafter/release-drafter@v5 with: + commitish: main config-name: release-drafter.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 64d32fc1e2b2d6010663ebe3930e629d630652a1 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 4 Sep 2023 15:11:34 +0100 Subject: [PATCH 3/3] Version --- .github/release-drafter.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index e3b3d43..5e970a2 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -23,6 +23,7 @@ change-template: '- $TITLE (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. tag-template: 'v$RESOLVED_VERSION' name-template: 'v$RESOLVED_VERSION 🌈' +version-template: '$MAJOR.$MINOR' autolabeler: - label: 'kind/chore' branch: @@ -62,19 +63,15 @@ template: | version-resolver: major: labels: - - 'major' - - 'breaking' + - 'disabled' minor: labels: - - 'minor' - - 'feature' - - 'status/enhancement' - - 'dependencies' + - 'kind/enhancement' + - 'kind/bug' + - 'kind/chore' + - 'kind/dependencies' + - 'kind/project' patch: labels: - - 'patch' - - 'fix' - - 'bugfix' - - 'status/bug' - - 'chore' + - 'disabled' default: patch