Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add labels automatically on PR creation or update #3187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have such a label

- 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label is currently used to identify bump of gh actions only. PR related to CI changes are labeled with "core".
Labels are used to generate the release notes and until now, we didn't consider to split CI changes from other "chore" changes

- 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have such a label

- 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'
13 changes: 12 additions & 1 deletion .github/workflows/pr-metadata-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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