diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000000..64d4fc9f84 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,83 @@ +# Add 'enhancement' label to any PR where the head branch name starts with `feat/` +enhancement: + - head-branch: ['^feat/'] + +# Add 'bug' label to any PR where the head branch name starts with `fix/` +bug: + - head-branch: ['^fix/'] + +# Add 'build' label to any PR where the head branch name starts with `build/` +build: + - head-branch: ['^build/'] + - changed-files: + - any-glob-to-any-file: + - '.nvmrc' + - 'package.json' + - 'package-lock.json' + - 'rollup.config.mjs' + - 'vite.config.js' + +# Add 'ci' label to any PR where the head branch name starts with `ci/` +github_actions: + - head-branch: ['^ci/'] + - changed-files: + - any-glob-to-any-file: + - '.github/**/*' # Any change to files within '.github' folder or any subfolders + +# Add 'defect' label to any PR where the head branch name starts with `defect/` +defect: + - head-branch: ['^defect/'] + +# Add 'documentation' label +documentation: + - head-branch: ['^docs/'] # Any PR where the head branch name starts with `docs/` + - changed-files: + - any-glob-to-any-file: + - 'docs/**' # Any change to files within 'docs' folder or any subfolders + - '**/*.md' # Any change to .md files within the entire repository + +example: + - head-branch: ['^example/'] + - changed-files: + - any-glob-to-any-file: + - 'dev/**' + +# Add 'performance' label to any PR where the head branch name starts with `perf/` +performance: + - head-branch: ['^perf/'] + +# Add 'poc' label to any PR where the head branch name starts with `poc/` +poc: + - head-branch: ['^poc/'] + +# Add 'refactoring' label to any PR where the head branch name starts with `refactor/` +refactoring: + - head-branch: ['^refactor/'] + +# Add 'style' label to any PR where the head branch name starts with `style/` +style: + - head-branch: ['^style/'] + +# Add 'test' label to any PR where the head branch name starts with `test/` +test: + - head-branch: ['^test/'] + - changed-files: + - any-glob-to-any-file: + - 'test/**' + +# Add 'chore' label to any PR where the head branch name starts with `chore/` +chore: + - head-branch: ['^chore/'] + - changed-files: + - all-globs-to-all-files: # EXCEPT the following files + - '!.github/**' + - '!dev/**' + - '!src/**' + - '!test/**' + - '!.nvmrc' + - '!package.json' + - '!package-lock.json' + - '!rollup.config.mjs' + - '!vite.config.js' + - '!docs/**' + - '!**/*.md' diff --git a/.github/workflows/pr-metadata-checks.yml b/.github/workflows/pr-metadata-checks.yml index 5e516d3a61..3ce634cce0 100644 --- a/.github/workflows/pr-metadata-checks.yml +++ b/.github/workflows/pr-metadata-checks.yml @@ -2,13 +2,24 @@ name: Check Pull Request Metadata on: pull_request_target: # trigger when the PR title changes - types: [opened, edited, reopened] + types: [opened, synchronize, reopened, edited] jobs: pr-title: + if: contains(fromJSON('["opened", "edited", "reopened"]'), github.event.action) runs-on: ubuntu-22.04 permissions: pull-requests: write # post comments when the PR title doesn't match the "Conventional Commits" rules steps: - name: Check Pull Request title uses: bonitasoft/actions/packages/pr-title-conventional-commits@v3 + + add-labels: + if: contains(fromJSON('["opened", "synchronize", "reopened"]'), github.event.action) + runs-on: ubuntu-22.04 + permissions: + contents: read + pull-requests: write + steps: + - name: Add labels to PR + uses: actions/labeler@v5