mirror of
https://github.com/actions/labeler.git
synced 2025-12-11 03:58:05 +00:00
Reworded readme with clearer examples
* Reformatted readme into headings with some basic rewording * Added basic and common examples Resolves #24
This commit is contained in:
46
README.md
46
README.md
@@ -2,24 +2,46 @@
|
||||
|
||||
Pull request labeler triages PRs based on the paths that are modified in the PR.
|
||||
|
||||
To use, create a `.github/labeler.yml` file with a list of labels and [minimatch](https://github.com/isaacs/minimatch)
|
||||
globs to match to apply the label.
|
||||
## Usage
|
||||
|
||||
Example:
|
||||
```
|
||||
### Create `.github/labeler.yml`
|
||||
|
||||
Create a `.github/labeler.yml` file with a list of labels and [minimatch](https://github.com/isaacs/minimatch) globs to match to apply the label.
|
||||
|
||||
The key is the name of the label in your repository that you want to add (eg: "merge conflict", "needs-updating") and the value is the path (glob) of the changed files (eg: `src/**/*`, `tests/*.spec.js`)
|
||||
|
||||
#### Basic Examples
|
||||
|
||||
```yml
|
||||
# Add 'label1' to any changes within 'example' folder or any subfolders
|
||||
label1:
|
||||
- example1/**/*
|
||||
- example/**/*
|
||||
|
||||
# Add 'label2' to any file changes within 'example2' folder
|
||||
label2: example2/*
|
||||
|
||||
label3:
|
||||
- example3/*
|
||||
- example3/**/*.yml
|
||||
```
|
||||
Where `"label1"` is the name of the label on your repository that you want to add (eg: "merge conflict", "needs-updating") and `"example1/**/*"` is the path of the changed files.
|
||||
|
||||
#### Common Examples
|
||||
|
||||
```yml
|
||||
# Add 'repo' label to any root file changes
|
||||
repo:
|
||||
- ./*
|
||||
|
||||
# Add '@domain/core' label to any change within the 'core' package
|
||||
@domain/core:
|
||||
- package/core/*
|
||||
- package/core/**/*
|
||||
|
||||
# Add 'test' label to any change to *.spec.js files within the source dir
|
||||
test:
|
||||
- src/**/*.spec.js
|
||||
```
|
||||
|
||||
### Create Workflow
|
||||
|
||||
Create a workflow (eg: `.github/workflows/labeler.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)) to utilize the labeler action with content:
|
||||
|
||||
Then create a workflow (eg: `.github/workflows/label.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)) utilizing the labeler action, granting access to the GITHUB_TOKEN so the action can make calls to GitHub's rest API:
|
||||
```
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
@@ -33,3 +55,5 @@ jobs:
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
```
|
||||
|
||||
_Note: This grants access to the `GITHUB_TOKEN` so the action can make calls to GitHub's rest API_
|
||||
|
||||
Reference in New Issue
Block a user