Skip to content

Commit

Permalink
ci: fix ci labeling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Sep 16, 2024
1 parent 0c0e6db commit 15af0a8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 27 deletions.
62 changes: 38 additions & 24 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,49 +66,63 @@ categories:

# Using regex for defining rules - https://regexr.com/
# https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax
# Auto-labeler: Assign labels based on branch names or PR titles that follow Conventional Commits
autolabeler:
- label: 'chore'
- label: 'feature'
branch:
- '/feat\/.+/' # Matches branch names starting with feat/
title:
- '/feat\: .+/' # Matches PR titles starting with feat:
- label: 'bugfix'
branch:
- '/fix\/.+/' # Matches branch names starting with fix/
title:
- '/fix\: .+/' # Matches PR titles starting with fix:
- label: 'documentation'
branch:
- '(chore)(\([a-z ]+\))?\/.'
- '/docs\/.+/' # Matches branch names starting with docs/
title:
- '^(chore)(\([a-z ]+\))?: .'
- label: 'bug'
- '/docs\: .+/' # Matches PR titles starting with docs:
- label: 'style'
branch:
- '(fix)(\([a-z ]+\))?\/.'
- '/style\/.+/' # Matches branch names starting with style/
title:
- '^(fix)(\([a-z ]+\))?: .'
- '/style\: .+/' # Matches PR titles starting with style:
- label: 'refactor'
branch:
- '(refactor)(\([a-z ]+\))?\/.'
- '/refactor\/.+/' # Matches branch names starting with refactor/
title:
- '^(refactor)(\([a-z ]+\))?: .'
- '/refactor\: .+/' # Matches PR titles starting with refactor:
- label: 'test'
branch:
- '(test)(\([a-z ]+\))?\/.'
- '/test\/.+/' # Matches branch names starting with test/
title:
- '^(test)(\([a-z ]+\))?: .'
- label: 'feature'
- '/test\: .+/' # Matches PR titles starting with test:
- label: 'chore'
branch:
- '/chore\/.+/' # Matches branch names starting with chore/
title:
- '/chore\: .+/' # Matches PR titles starting with chore:
- label: 'performance'
branch:
- '(feat)(\([a-z ]+\))?\/.'
- '/perf\/.+/' # Matches branch names starting with perf/
title:
- '^(feat)(\([a-z ]+\))?: .'
- label: 'ci/cd'
- '/perf\: .+/' # Matches PR titles starting with perf:
- label: 'ci'
branch:
- '(ci)(\([a-z ]+\))?\/.'
- '/ci\/.+/' # Matches branch names starting with ci/
title:
- '^(ci)(\([a-z ]+\))?: .'
- label: 'minor'
- '/ci\: .+/' # Matches PR titles starting with ci:
- label: 'build'
branch:
- '(feat)(\([a-z ]+\))?\/.'
- '/build\/.+/' # Matches branch names starting with build/
title:
- '^(feat)(\([a-z ]+\))?: .'
- label: 'patch'
- '/build\: .+/' # Matches PR titles starting with build:
- label: 'revert'
branch:
- '(fix)(\([a-z ]+\))?\/.'
- '(ci)(\([a-z ]+\))?\/.'
- '/revert\/.+/' # Matches branch names starting with revert/
title:
- '^(fix)(\([a-z ]+\))?: .'
- '^(ci)(\([a-z ]+\))?: .'
- '/revert\: .+/' # Matches PR titles starting with revert:

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/release-drafter-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ on:
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
pull_request_target:
types: [opened, reopened, synchronize]

jobs:
auto-labeler:
name: Release drafter Auto Labeler
runs-on: ubuntu-latest
permissions:
# Setting up permissions in the workflow to limit the scope of what it can do. Optional!
contents: read
pull-requests: write
statuses: write
checks: write

steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
disable-autolabeler: false
disable-releaser: true # only run auto-labeler for PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
id: semantic
with:
config-name: release-drafter.yml
disable-autolabeler: true
## Default versioning just increase the path version as default. but the can use minor, patch and breaking-changes labels to apply semver
# version: 1.29.1
env:
Expand Down

0 comments on commit 15af0a8

Please sign in to comment.