diff --git a/.github/multi-labeler.yml b/.github/multi-labeler.yml index 84dd639..d83f975 100644 --- a/.github/multi-labeler.yml +++ b/.github/multi-labeler.yml @@ -5,83 +5,84 @@ version: v1 labels: - label: "feature" matcher: - title: '^(feat)(\([a-z ]+\))?: .' - commits: '^(feat)(\([a-z ]+\))?: .' - branch: '^(feat)(\([a-z ]+\))?\/.' + title: '/^(feat)(\([a-z ]+\))?: .+/' + commits: '/^(feat)(\([a-z ]+\))?: .+/' + branch: '/^(feat)(\([a-z ]+\))?\/.+/' - label: "bug" matcher: - title: '^(fix)(\([a-z ]+\))?: .' - commits: '^(fix)(\([a-z ]+\))?: .' - branch: '^(fix)(\([a-z ]+\))?\/.' + title: '/^(fix)(\([a-z ]+\))?: .+/' + commits: '/^(fix)(\([a-z ]+\))?: .+/' + branch: '/^(fix)(\([a-z ]+\))?\/.+/' - label: "chore" matcher: - title: '^(chore)(\([a-z ]+\))?: .' - commits: '^(chore)(\([a-z ]+\))?: .' - branch: '^(chore)(\([a-z ]+\))?\/.' + title: '/^(chore)(\([a-z ]+\))?: .+/' + commits: '/^(chore)(\([a-z ]+\))?: .+/' + branch: '/^(chore)(\([a-z ]+\))?\/.+/' - label: "documentation" matcher: - title: '^(docs)(\([a-z ]+\))?: .' - commits: '^(docs)(\([a-z ]+\))?: .' - branch: '^(docs)(\([a-z ]+\))?\/.' + title: '/^(docs)(\([a-z ]+\))?: .+/' + commits: '/^(docs)(\([a-z ]+\))?: .+/' + branch: '/^(docs)(\([a-z ]+\))?\/.+/' - label: "devops" matcher: - title: '^(ci)(\([a-z ]+\))?: .' - commits: '^(ci)(\([a-z ]+\))?: .' - branch: '^(ci)(\([a-z ]+\))?\/.' + title: '/^(ci)(\([a-z ]+\))?: .+/' + commits: '/^(ci)(\([a-z ]+\))?: .+/' + branch: '/^(ci)(\([a-z ]+\))?\/.+/' - label: "ci-cd" matcher: - title: '^(ci)(\([a-z ]+\))?: .' - commits: '^(ci)(\([a-z ]+\))?: .' - branch: '^(ci)(\([a-z ]+\))?\/.' + title: '/^(ci)(\([a-z ]+\))?: .+/' + commits: '/^(ci)(\([a-z ]+\))?: .+/' + branch: '/^(ci)(\([a-z ]+\))?\/.+/' - label: "enhancement" matcher: - title: '^(refactor)(\([a-z ]+\))?: .' - commits: '^(refactor)(\([a-z ]+\))?: .' - branch: '^(refactor)(\([a-z ]+\))?\/.' + title: '/^(refactor)(\([a-z ]+\))?: .+/' + commits: '/^(refactor)(\([a-z ]+\))?: .+/' + branch: '/^(refactor)(\([a-z ]+\))?\/.+/' - label: "style" matcher: - title: '^(style)(\([a-z ]+\))?: .' - commits: '^(style)(\([a-z ]+\))?: .' - branch: '^(style)(\([a-z ]+\))?\/.' + title: '/^(style)(\([a-z ]+\))?: .+/' + commits: '/^(style)(\([a-z ]+\))?: .+/' + branch: '/^(style)(\([a-z ]+\))?\/.+/' - label: "performance" matcher: - title: '^(perf)(\([a-z ]+\))?: .' - commits: '^(perf)(\([a-z ]+\))?: .' - branch: '^(perf)(\([a-z ]+\))?\/.' + title: '/^(perf)(\([a-z ]+\))?: .+/' + commits: '/^(perf)(\([a-z ]+\))?: .+/' + branch: '/^(perf)(\([a-z ]+\))?\/.+/' - label: "build" matcher: - title: '^(build)(\([a-z ]+\))?: .' - commits: '^(build)(\([a-z ]+\))?: .' - branch: '^(build)(\([a-z ]+\))?\/.' + title: '/^(build)(\([a-z ]+\))?: .+/' + commits: '/^(build)(\([a-z ]+\))?: .+/' + branch: '/^(build)(\([a-z ]+\))?\/.+/' - label: "test" matcher: - title: '^(test)(\([a-z ]+\))?: .' - commits: '^(test)(\([a-z ]+\))?: .' - branch: '^(test)(\([a-z ]+\))?\/.' + title: '/^(test)(\([a-z ]+\))?: .+/' + commits: '/^(test)(\([a-z ]+\))?: .+/' + branch: '/^(test)(\([a-z ]+\))?\/.+/' - label: "dependencies" matcher: - title: '^build\(deps\): .' - commits: '^build\(deps\): .' + title: '/^(build)(\([a-z ]+\))?: .+/' + commits: '/^(build)(\([a-z ]+\))?: .+/' + branch: '/^(build)(\([a-z ]+\))?\/.+/' - label: "minor" matcher: - title: '^(feat)(\([a-z ]+\))?: .' - commits: '^(feat)(\([a-z ]+\))?: .' - branch: '^(feat)(\([a-z ]+\))?\/.' + title: '/^(feat)(\([a-z ]+\))?: .+/' + commits: '/^(feat)(\([a-z ]+\))?: .+/' + branch: '/^(feat)(\([a-z ]+\))?\/.+/' - label: "patch" matcher: - title: '^(fix)(\([a-z ]+\))?: .' - commits: '^(fix)(\([a-z ]+\))?: .' - branch: '^(fix)(\([a-z ]+\))?\/.' + title: '/^(fix)(\([a-z ]+\))?: .+/' + commits: '/^(fix)(\([a-z ]+\))?: .+/' + branch: '/^(fix)(\([a-z ]+\))?\/.+/' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index c26a7f4..071a697 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -70,48 +70,69 @@ categories: # https://www.trywilco.com/post/wilco-ci-cd-github-heroku # https://github.com/release-drafter/release-drafter#autolabeler # https://github.com/fuxingloh/multi-labeler - # 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 +# Note: because of escaping logic inside of release drafter our regex should be escaped correctly and drafter wil un-escape it internally +# - Escaped regex: When writing a regular expression as a string in code, special characters like (, ), and : need to be escaped with a backslash (\) because these characters have special meanings in regex. +# - Unescaped regex: If you use a raw regex literal (i.e., surrounded by slashes /.../), the regex engine interprets it directly, and you don’t need to double-escape the special characters. autolabeler: -- label: "chore" - branch: - - '^(chore)(\([a-z ]+\))?\/.' - title: - - '^(chore)(\([a-z ]+\))?: .' -- label: "bug" - branch: - - '^(fix)(\([a-z ]+\))?\/.' - title: - - '^(fix)(\([a-z ]+\))?: .' -- label: "feature" - branch: - - '^(feat)(\([a-z ]+\))?\/.' - title: - - '^(feat)(\([a-z ]+\))?: .' -- label: "style" - branch: - - '^(style)(\([a-z ]+\))?\/.' - title: - - '^(style)(\([a-z ]+\))?: .' -- label: "ci-cd" - branch: - - '^(ci)(\([a-z ]+\))?\/.' - title: - - '^(ci)(\([a-z ]+\))?: .' -- label: "minor" +- label: 'chore' + branch: + - '/^(chore)(\([a-z ]+\))?\/.+/' + title: + - '/^(chore)(\([a-z ]+\))?: .+/' +- label: 'enhancement' + branch: + - '/^(refactor)(\([a-z ]+\))?\/.+/' + title: + - '/^(refactor)(\([a-z ]+\))?: .+/' +- label: 'documentation' + branch: + - '/^(docs)(\([a-z ]+\))?\/.+/' + title: + - '/^(docs)(\([a-z ]+\))?: .+/' +- label: 'ci-cd' + branch: + - '/^(ci)(\([a-z ]+\))?\/.+/' + title: + - '/^(ci)(\([a-z ]+\))?: .+/' +- label: 'devops' + branch: + - '/^(ci)(\([a-z ]+\))?\/.+/' + title: + - '/^(ci)(\([a-z ]+\))?: .+/' +- label: 'test' + branch: + - '/^(test)(\([a-z ]+\))?\/.+/' + title: + - '/^(test)(\([a-z ]+\))?: .+/' +- label: 'bug' + branch: + - '/^(fix)(\([a-z ]+\))?\/.+/' + title: + - '/^(fix)(\([a-z ]+\))?: .+/' +- label: 'style' + branch: + - '/^(style)(\([a-z ]+\))?\/.+/' + title: + - '/^(style)(\([a-z ]+\))?: .+/' +- label: 'feature' + branch: + - '/^(feat)(\([a-z ]+\))?\/.+/' + title: + - '/^(feat)(\([a-z ]+\))?: .+/' +- label: 'minor' branch: - - '^(feat)(\([a-z ]+\))?\/.' + - '/^(feat)(\([a-z ]+\))?\/.+/' title: - - '^(feat)(\([a-z ]+\))?: .' -- label: "patch" + - '/^(feat)(\([a-z ]+\))?: .+/' +- label: 'patch' branch: - - '^(fix)(\([a-z ]+\))?\/.' - - '^(ci)(\([a-z ]+\))?\/.' + - '/^(fix)(\([a-z ]+\))?\/.+/' + - '/^(ci)(\([a-z ]+\))?\/.+/' title: - - '^(fix)(\([a-z ]+\))?: .' - - '^(ci)(\([a-z ]+\))?: .' + - '/^(fix)(\([a-z ]+\))?: .+/' + - '/^(ci)(\([a-z ]+\))?: .+/' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index d8f3efc..630a728 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,9 +2,13 @@ name: Auto Labeler on: pull_request: - types: [opened, edited, synchronize, ready_for_review] - - pull_request_target: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + # pull_request_target: jobs: auto-labeler: @@ -20,13 +24,12 @@ jobs: # checks: write steps: - ## doesn't work - # - uses: release-drafter/release-drafter@v6 - # with: - # config-name: release-drafter.yml - # disable-releaser: true # releaser mode is disabled. - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter.yml + disable-releaser: true # releaser mode is disabled. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - uses: fuxingloh/multi-labeler@v1 # name: conventional-commits-pull-request-labeler @@ -34,14 +37,14 @@ jobs: # github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' # config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' - # https://github.com/actions/labeler - - uses: actions/labeler@v5 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - sync-labels: true + # # https://github.com/actions/labeler + # - uses: actions/labeler@v5 + # with: + # repo-token: "${{ secrets.GITHUB_TOKEN }}" + # sync-labels: true - # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs - # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow + # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs + # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow - name: check-conventional-commits-labels uses: docker://agilepathway/pull-request-label-checker:latest if: success() diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5bac388..b5bce64 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -5,23 +5,23 @@ name: Release Drafter on: push: branches: - - main + - "main" jobs: - update_release_draft: + update-release-draft: name: Release drafter runs-on: ubuntu-latest permissions: # write permission is required to create a github release contents: write - steps: - name: Update Release Draft uses: release-drafter/release-drafter@v6 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: