Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/banyan/auto-label
A GitHub action to add labels to Pull Request based on matched file patterns
https://github.com/banyan/auto-label
Last synced: 3 months ago
JSON representation
A GitHub action to add labels to Pull Request based on matched file patterns
- Host: GitHub
- URL: https://github.com/banyan/auto-label
- Owner: banyan
- License: mit
- Created: 2019-02-12T01:21:21.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-08T15:35:32.000Z (over 1 year ago)
- Last Synced: 2024-10-26T09:30:22.136Z (3 months ago)
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/auto-label-action
- Size: 1.49 MB
- Stars: 63
- Watchers: 4
- Forks: 10
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-actions - Add Labels to a PR based on Matched File Patterns
- fucking-awesome-actions - Add Labels to a PR based on Matched File Patterns
- awesome-workflows - Add Labels to a PR based on Matched File Patterns
README
# auto-label
> A GitHub action to add labels to Pull Request based on matched file patterns
## Installation
To configure the action simply add the following lines to your `.github/workflows/auto-label.yml` file:
```yaml
name: Auto Label
on:
pull_request:
types: [opened, synchronize]jobs:
auto-label:
name: Auto Label
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: banyan/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```NOTE: `pull_request` event is triggered by [many actions](https://developer.github.com/v3/activity/events/types/#pullrequestevent), so please make sure to filter by `[opened, synchronize]` of [on..types](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onevent_nametypes) as in the example above.
And configure by creating `.github/auto-label.json` file.
The format is `label: rule`:```ts
{ [key: string]: string | string[] }
```Pattern matching is following `.gitignore` [spec](https://git-scm.com/docs/gitignore#_pattern_format) using by [node-ignore](https://github.com/kaelzhang/node-ignore).
```json
{
"rules": {
"frontend": ["*.js", "*.css", "*.html"],
"backend": ["app/", "*.rb"],
"ci": ".circleci"
}
}
```## Features
* Remove label in the PR if the file has been removed.
* If there's no adding / removing labels, it will only consumes 1 point of rate limit score.
* https://developer.github.com/v4/guides/resource-limitations/## Tips
* In case if you want to debug the response quickly, just set `ACTIONS_STEP_DEBUG` as `true` on Secrets from Settings of GitHub.
### TODO
* Handle pagination of label (currently only handles 100)