From 5eb7f9f1f47b178474893d642161db64cda0089b Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Sat, 16 Mar 2024 03:48:51 +0530 Subject: [PATCH] chore(ci): Enhance release notes workflow settings (#183) This pull request updates the release-drafter template to enhance the quality of release notes. Additionally, we've introduced two new triggers, `pull_request` and `pull_request_target`, which automatically apply labels to pull requests based on their titles. This is essential for autolabeling and to accommodate pull requests from forks. --- .github/release-drafter.yml | 109 ++++++++++++++++++++++++++-- .github/workflows/release-notes.yml | 17 +++-- 2 files changed, 110 insertions(+), 16 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 1e568b62..eca4d3f8 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,24 +1,117 @@ name-template: $RESOLVED_VERSION tag-template: v$RESOLVED_VERSION +pull-request: + title-templates: + fix: '🐛 $TITLE (#$NUMBER)' + feat: '🚀 $TITLE (#$NUMBER)' + default: '$TITLE (#$NUMBER)' +autolabeler: + - label: 'bug' + branch: + - '/fix\/.+/' + title: + - '/fix/i' + - label: 'improvement' + branch: + - '/improv\/.+/' + title: + - '/improv/i' + - label: 'feature' + branch: + - '/feature\/.+/' + title: + - '/feat/i' + - label: 'documentation' + branch: + - '/docs\/.+/' + title: + - '/docs/i' + - label: 'maintenance' + branch: + - '/(chore|refactor|style|test|ci|perf|build)\/.+/' + title: + - '/(chore|refactor|style|test|ci|perf|build)/i' + - label: 'chore' + branch: + - '/chore\/.+/' + title: + - '/chore/i' + - label: 'refactor' + branch: + - '/refactor\/.+/' + title: + - '/refactor/i' + - label: 'style' + branch: + - '/style\/.+/' + title: + - '/style/i' + - label: 'test' + branch: + - '/test\/.+/' + title: + - '/test/i' + - label: 'ci' + branch: + - '/ci\/.+/' + title: + - '/ci/i' + - label: 'perf' + branch: + - '/perf\/.+/' + title: + - '/perf/i' + - label: 'build' + branch: + - '/build\/.+/' + title: + - '/build/i' + - label: 'deps' + branch: + - '/deps\/.+/' + title: + - '/deps/i' + - label: 'revert' + branch: + - '/revert\/.+/' + title: + - '/revert/i' categories: - - title: 🚀 Features + - title: '🚀 Features' labels: + - 'feature' - "type: enhancement" - "type: new feature" - "type: major" - - title: 🚀 Bug Fixes/Improvements + - "type: minor" + - title: '💡 Improvements' labels: + - 'improvement' - "type: improvement" + + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bug' - "type: bug" - - "type: minor" - - title: 🛠 Dependency upgrades + - title: '📚 Documentation' labels: - - "type: dependency upgrade" - - "dependencies" - - title: ⚙️ Build/CI + - 'docs' + - title: '🔧 Maintenance' labels: + - 'maintenance' + - 'chore' + - 'refactor' + - 'style' + - 'test' + - 'ci' + - 'perf' + - 'build' - "type: ci" - "type: build" + - title: '⏪ Reverts' + labels: + - 'revert' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' version-resolver: major: @@ -38,4 +131,4 @@ template: | ## Contributors - $CONTRIBUTORS + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 2a6465a4..1b48ca5b 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -5,28 +5,29 @@ on: push: branches: - '[4-9]+.[0-9]+.x' + pull_request: + types: [opened, reopened, synchronize, labeled] + pull_request_target: + types: [opened, reopened, synchronize, labeled] workflow_dispatch: jobs: release_notes: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check if it has release drafter config file id: check_release_drafter run: | has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false") - echo ::set-output name=has_release_drafter::${has_release_drafter} + echo "has_release_drafter=${has_release_drafter}" >> $GITHUB_OUTPUT - name: Extract branch name id: extract_branch - run: echo ::set-output name=value::${GITHUB_REF:11} + run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT # If it has release drafter: - - uses: release-drafter/release-drafter@v5.21.1 + - uses: release-drafter/release-drafter@v6 if: steps.check_release_drafter.outputs.has_release_drafter == 'true' env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - with: - commitish: ${{ steps.extract_branch.outputs.value }} - filter-by-commitish: true # Otherwise: - name: Export Gradle Properties if: steps.check_release_drafter.outputs.has_release_drafter == 'false' @@ -45,4 +46,4 @@ jobs: name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }} tag: v${{ steps.release_notes.outputs.next_version }} bodyFile: CHANGELOG.md - token: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.GH_TOKEN }} \ No newline at end of file