From 9ac46b3677b200a969d79ac632f9e3ab31102334 Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 22 May 2024 16:14:04 -0400 Subject: [PATCH] [CI] add action to label PRs based on title and draft releases (#327) * add action to label PRs based on title and draft releases --- .github/PULL_REQUEST_TEMPLATE.md | 26 ++++----- .github/labels.yml | 51 +++++++++++------- .github/release-drafter.yml | 76 +++++++++++++++++++++------ .github/workflows/build_test_ci.yml | 1 + .github/workflows/release-drafter.yml | 24 +++++++++ CONTRIBUTING.md | 25 ++++----- 6 files changed, 141 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f6e81aa17..ac4f2222e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,20 +1,16 @@ - - -**What type of PR is this?** - - - **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #(, fixes #, ...)` format, will close the issue(s) when PR gets merged)*: diff --git a/.github/labels.yml b/.github/labels.yml index f9b89f118..7b91ed41c 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -1,24 +1,35 @@ -- name: added-feature +# PR Labels +- name: new-feature description: for new features in the changelog. - color: a2eeef -- name: changed - description: for changes in existing functionality in the changelog. - color: a2eeef -- name: deprecated - description: for soon-to-be removed features in the changelog. - color: e4e669 -- name: removed - description: for now removed features in the changelog. - color: e4e669 + color: 225fee +- name: improvement + description: for improvements in existing functionality in the changelog. + color: 22ee47 +- name: repo-ci-improvement + description: for improvements in the repository or CI workflow in the changelog. + color: c922ee - name: bugfix description: for any bug fixes in the changelog. - color: d73a4a -- name: security - description: for vulnerabilities in the changelog. - color: dd4739 -- name: bug - description: Something isn't working in this issue. - color: d73a4a + color: ed8e21 +- name: documentation + description: for updates to the documentation in the changelog. + color: d3e1e6 +- name: dependencies + description: dependency updates including security fixes + color: 5c9dff +- name: testing + description: for updates to the testing suite in the changelog. + color: 933ac9 +- name: breaking-change + description: for breaking changes in the changelog. + color: ff0000 +- name: ignore-for-release + description: PRs you do not want to render in the changelog. + color: 7b8eac +# Issue Labels - name: enhancement - description: New feature request in this issue. - color: a2eeef + description: issues that request a enhancement. + color: 22ee47 +- name: bug + description: issues that report a bug. + color: ed8e21 diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 16531cb64..d880f84a0 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,21 +1,67 @@ name-template: 'v$NEXT_PATCH_VERSION' tag-template: 'v$NEXT_PATCH_VERSION' +exclude-labels: + - ignore-for-release categories: - - title: '๐Ÿš€ Added' - label: 'added-feature' - - title: '๐Ÿงฐ Changed' - label: 'changed' - - title: "โš ๏ธ Deprecated" - label: "deprecated" - - title: "โš ๏ธ Removed" - label: "removed" - - title: '๐Ÿ› Bug Fixes' - label: 'bugfix' - - title: "โš ๏ธ Security" - label: "security" -change-template: '- $TITLE @$AUTHOR (#$NUMBER)' + - title: โš ๏ธ Breaking Change + labels: + - breaking-change + - title: ๐Ÿ› Bug Fixes + labels: + - bugfix + - title: ๐Ÿš€ New Features + labels: + - new-feature + - title: ๐Ÿ’ก Improvements + labels: + - improvement + - title: ๐Ÿงช Testing Improvements + labels: + - testing + - title: โš™๏ธ Repo/CI Improvements + labels: + - repo-ci-improvement + - title: ๐Ÿ“– Documentation + labels: + - documentation + - title: ๐Ÿ“ฆ Dependency Updates + labels: + - dependencies + - title: Other Changes + labels: + - "*" +autolabeler: + - label: 'breaking-change' + title: + - '/.*\[breaking\].+/' + - label: 'deprecation' + title: + - '/.*\[deprecation\].+/' + - label: 'bugfix' + title: + - '/.*\[fix\].+/' + - label: 'new-feature' + title: + - '/.*\[feat\].+/' + - label: 'improvement' + title: + - '/.*\[improvement\].+/' + - label: 'testing' + title: + - '/.*\[test\].+/' + - label: 'repo-ci-improvement' + title: + - '/.*\[CI\].+/' + - '/.*\[ci\].+/' + - label: 'documentation' + title: + - '/.*\[docs\].+/' + - label: 'dependencies' + title: + - '/.*\[deps\].+/' + +change-template: '- $TITLE by @$AUTHOR in #$NUMBER' no-changes-template: "- No changes" template: | - ## Changes - + ## What's Changed $CHANGES diff --git a/.github/workflows/build_test_ci.yml b/.github/workflows/build_test_ci.yml index 12b9b733d..289798e25 100644 --- a/.github/workflows/build_test_ci.yml +++ b/.github/workflows/build_test_ci.yml @@ -63,6 +63,7 @@ jobs: storage.googleapis.com:443 cli.codecov.io:443 api.codecov.io:443 + raw.githubusercontent.com:443 - uses: actions/checkout@v4 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..de9ffe2fe --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,24 @@ +name: Release Drafter + +on: + push: + branches: + - master + pull_request: + types: [opened, reopened, synchronize] + pull_request_target: + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 506769538..cee6fdea8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,19 +39,20 @@ Tips for a faster merge: 1. Fork the desired repo, develop and test your code changes. 1. See the [Development Guide](https://linode.github.io/cluster-api-provider-linode/developers/development.html) for more instructions on setting up your environment and testing changes locally. 2. Submit a pull request. - 1. All PRs should be labeled with one of the following kinds - - `/kind feature` for PRs related to adding new features/tests - - `/kind bug` for PRs related to bug fixes and patches - - `/kind api-change` for PRs related to adding, removing, or otherwise changing an API - - `/kind cleanup` for PRs related to code refactoring and cleanup - - `/kind deprecation` for PRs related to a feature/enhancement marked for deprecation. - - `/kind design` for PRs related to design proposals - - `/kind documentation` for PRs related to documentation - - `/kind other` for PRs related to updating dependencies, minor changes or other - 2. All code changes must be covered by unit tests and E2E tests. - 3. All new features should come with user documentation. + 1. All PRs titles should start with one of the following prefixes + - `[fix]` for PRs related to bug fixes and patches + - `[feat]` for PRs related to new features + - `[improvement]` for PRs related to improvements of existing features + - `[test]` for PRs related to tests + - `[CI]` for PRs related to repo CI improvements + - `[docs]` for PRs related to documentation updates + - `[deps]` for PRs related to dependency updates + 2. if a PR introduces a breaking change it should include `[breaking]` in the title + 3. if a PR introduces a deprecation it should include `[deprecation]` in the title + 4. All code changes must be covered by unit tests and E2E tests. + 5. All new features should come with user documentation. 3. Ensure that commit message(s) are be meaningful and commit history is readable. -5. All changes must be code reviewed. Refer to the following for code conventions and standards: +4. All changes must be code reviewed. Refer to the following for code conventions and standards: - The official [Kubernetes developer guide](https://github.com/kubernetes/community/tree/master/contributors/devel) - [Go Code Review Comments](https://go.dev/wiki/CodeReviewComments) identifies some common style mistakes when writing Go - [Uber's Go Style Guide](https://github.com/uber-go/guide/blob/master/style.md) promotes preferred code conventions