Skip to content

Commit

Permalink
add auto labeler (#89)
Browse files Browse the repository at this point in the history
* fix pre-commit

* add auto labeler
  • Loading branch information
john0isaac authored Dec 15, 2024
1 parent 828a819 commit 99929c6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Add 'root' label to any root file changes
# Quotation marks are required for the leading asterisk
root:
- changed-files:
- any-glob-to-any-file: '*'

# Add 'documentation' label to any file changes within 'docs' or 'guides' folders
# Add 'documentation' label to any change to .md files within the entire repository
documentation:
- changed-files:
- any-glob-to-any-file: ['docs/**', 'guides/**']
- any-glob-to-any-file: '**/*.md'

# Add 'source' label to any change to src files within the source dir EXCEPT for the docs sub-folder
source:
- all:
- changed-files:
- any-glob-to-any-file: 'src/**/*'
- all-globs-to-all-files: '!src/docs/*'

# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
feature:
- head-branch: ['^feature', 'feature', 'feat', '^feat']

bug:
- head-branch: ['^fix', 'fix', '^bug', 'bug', '^issue', 'issue']

# Add 'release' label to any PR that is opened against the `main` branch
release:
- base-branch: 'main'

ci-cd:
- changed-files:
- any-glob-to-any-file: '.github/workflows/**'

dev-tools:
- changed-files:
- any-glob-to-any-file: '.vscode/**'
- any-glob-to-any-file: '.devcontainer/**'
16 changes: 16 additions & 0 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Request Labeler

on:
workflow_dispatch:
pull_request_target:

permissions:
contents: read
pull-requests: write

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/labeler@v5
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.12
python: python3.12
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -21,4 +21,4 @@ repos:
- id: ruff
args: ["--fix"]
# Run the formatter.
- id: ruff-format
- id: ruff-format

0 comments on commit 99929c6

Please sign in to comment.