Skip to content

Commit

Permalink
ci: Release drafting and autolabeler (#54)
Browse files Browse the repository at this point in the history
* ci: Setup autolabeler and release drafting

* update workflow readme
  • Loading branch information
bjchambers authored Jan 31, 2024
1 parent a4e847a commit 6ee3d42
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 6 deletions.
78 changes: 78 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -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'
12 changes: 6 additions & 6 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -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
- Require conditional checks https://github.com/marketplace/actions/require-conditional-status-checks
17 changes: 17 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
26 changes: 26 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 6ee3d42

Please sign in to comment.