From 85ec3938ed693dff1fe093ebb72e953939a9a0ab Mon Sep 17 00:00:00 2001 From: Ben Chambers <35960+bjchambers@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:52:04 -0800 Subject: [PATCH 1/2] ci: Setup autolabeler and release drafting --- .github/release-drafter.yml | 78 +++++++++++++++++++++++++++ .github/workflows/lint-pr.yml | 17 ++++++ .github/workflows/release-drafter.yml | 26 +++++++++ 3 files changed, 121 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..503f02c --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,78 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: 'Breaking Changes' + lables: + - 'breaking' + - title: '🚀 Features' + labels: + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'bug' + - title: '📄 Docs' + labels: + - 'docs' + - title: '🧰 Maintenance' + collapse-after: 5 + labels: + - 'chore' + - 'build' + - 'ci' + - 'refactor' + - 'perf' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'breaking' + minor: + labels: + - 'enhancement' + patch: + labels: + - 'bug' + - 'perf' + default: patch +template: | + ## Changes + + $CHANGES +# Assign labels to PRs +autolabeler: + - label: 'docs' + files: + - docs/* + title: + - '/^docs/' + - label: 'breaking' + title: + - '/^[a-zA-Z0-9()]+!/' + - label: 'bug' + title: + - '/^fix/i' + - label: 'test' + title: + - '/^test/i' + - label: 'perf' + title: + - '/^perf/i' + - label: 'enhancement' + title: + - '/^feat/i' + - label: 'chore' + title: + - '/^chore/i' + - label: 'build' + title: + - '/^build/i' + - label: 'ci' + title: + - '/^ci/i' + - label: 'revert' + title: + - '/^revert/i' + - label: 'refactor' + title: + - '/^refactor/i' \ No newline at end of file diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 080e9d4..66797ef 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -6,10 +6,27 @@ on: - edited - synchronize +permissions: + contents: read + jobs: lint_pr: runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@v5.4.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + autolabeler: + permissions: + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..0378046 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,26 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - main + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # read permission is required to list PRs + pull-requests: read + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From cbb740462c6b89e424ec6e86d077985b1b8660fa Mon Sep 17 00:00:00 2001 From: Ben Chambers <35960+bjchambers@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:10:10 -0800 Subject: [PATCH 2/2] update workflow readme --- .github/workflows/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index f0e7f43..6141ad7 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,14 +1,14 @@ # GitHub Actions for Dewy -We currently have 3 workflows: +We currently have the following workflows: 1. `ci.yml` defines the CI process for the core service and clients. -2. `lint-pr.yml` defines linting of the PR itself (comments, etc.). +2. `lint-pr.yml`: Checks PRs for style, naming, and provides some automation. + - Verifies the title of the PR conforms to conventional commits. + - Runs an "autolabeler" to provide labels based on title and files touched. 3. `site.yml` defines the build and deployment process for the site. +4. `release-drafter.yml`: Generates draft release notes as PRs are merged. ## Future Improvements -1. Release drafting / publishing. -2. Assign labels to PRs based on directories touched (eg., `docs`, `service`, etc.) and - conventional commit (`fix`, `feature`, etc.). -3. Require conditional checks https://github.com/marketplace/actions/require-conditional-status-checks \ No newline at end of file +- Require conditional checks https://github.com/marketplace/actions/require-conditional-status-checks \ No newline at end of file