Skip to content

Commit

Permalink
add conventional commit auto labeler
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Jun 6, 2024
1 parent 2e03912 commit b6515bc
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 50 deletions.
50 changes: 0 additions & 50 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,3 @@ autolabeler:
- label: breaking
title:
- '/^[a-z]+(\(.*\))?\!\:/'
# ------------------------------------ RELEASE CONFIGURATION ------------------------------------ #
category-template: "### $TITLE"
change-template: "- $TITLE by @$AUTHOR in [#$NUMBER]($URL)"
replacers:
# remove conventional commit tag & scope from change list
- search: '/- [a-z]+(\(.*\))?(\!)?\: /g'
replace: "- "
template: |
## What's Changed
$CHANGES
**Full Changelog:** [`$PREVIOUS_TAG...v$RESOLVED_VERSION`](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION)
categories:
- title: ⚠️ Breaking Changes
labels:
- breaking
- title: ✨ New Features
labels:
- enhancement
- title: 🐞 Bug Fixes
labels:
- fix
- title: 🏎️ Performance Improvements
labels:
- performance
- title: 📚 Documentation
labels:
- documentation
- title: 🏗️ Testing
labels:
- test
- title: ⚙️ Automation
labels:
- ci
- title: 🛠 Builds
labels:
- build
- title: 💎 Code Style
labels:
- style
- title: 📦 Refactorings
labels:
- refactor
- title: ♻️ Chores
labels:
- chore
- title: 🗑 Reverts
labels:
- revert
36 changes: 36 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
changelog:
exclude:
labels:
- ignore for release
categories:
- title: 🚨 Breaking changes
labels:
- breaking
- title: ✨ New features
labels:
- enhancement
- title: 🚀 Performance
labels:
- performance
- title: 🐛 Bug fixes
labels:
- bug
- fix
- title: 📝 Documentation
labels:
- documentation
- title: 🧪 Tests
labels:
- test
- title: ⬆️ Dependencies
labels:
- dependencies
- title: 🤖 CI
labels:
- ci
- title: 🏗️ Refactor
labels:
- refactor
- title: 🤷🏻 Other changes
labels:
- '*'
58 changes: 58 additions & 0 deletions .github/workflows/chore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Chore
on:
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-pr-title:
name: Check PR Title
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check valid conventional commit message
id: lint
uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e
with:
subjectPattern: ^[A-Za-z].+[^. ]$ # subject must start with letter and may not end with a dot/space
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Post comment about invalid PR title
if: failure()
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31
with:
header: conventional-commit-pr-title
message: |
Thank you for opening this pull request! 👋🏼
This repository requires pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
<details><summary><b>Details</b></summary>
```
${{ steps.lint.outputs.error_message }}
```
</details>
- name: Delete comment about invalid PR title
if: success()
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31
with:
header: conventional-commit-pr-title
delete: true

- name: Assign labels
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348
with:
disable-releaser: true
disable-autolabeler: false
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit b6515bc

Please sign in to comment.