diff --git a/struct_module/contribs/github/workflows/labeler.yaml b/struct_module/contribs/github/workflows/labeler.yaml new file mode 100644 index 0000000..7896ac4 --- /dev/null +++ b/struct_module/contribs/github/workflows/labeler.yaml @@ -0,0 +1,69 @@ +structure: + - .github/labeler.yml: + content: | + # 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 'AnyChange' label to any changes within the entire repository + AnyChange: + - changed-files: + - any-glob-to-any-file: '**' + + # Add 'Documentation' label to any changes within 'docs' folder or any subfolders + Documentation: + - changed-files: + - any-glob-to-any-file: docs/** + + # Add 'Documentation' label to any file changes within 'docs' folder + Documentation: + - changed-files: + - any-glob-to-any-file: docs/* + + # Add 'Documentation' label to any file changes within 'docs' or 'guides' folders + Documentation: + - changed-files: + - any-glob-to-any-file: + - docs/* + - guides/* + + ## Equivalent of the above mentioned configuration using another syntax + Documentation: + - changed-files: + - any-glob-to-any-file: ['docs/*', 'guides/*'] + + # Add 'Documentation' label to any change to .md files within the entire repository + Documentation: + - changed-files: + - 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'] + + # Add 'release' label to any PR that is opened against the `{{@ current_repo() | default_branch @}}` branch + release: + - base-branch: '{{@ current_repo() | default_branch @}}' + - .github/workflows/labeler.yaml: + content: | + name: "labeler" + on: + - pull_request_target + + jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@{{@ "actions/labeler" | latest_release @}}