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:
Callum Silcock
2019-09-26 16:53:38 +01:00
committed by GitHub
parent df04112348
commit 00584cab2c

View File

@@ -2,24 +2,46 @@
Pull request labeler triages PRs based on the paths that are modified in the PR. 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) ## Usage
globs to match to apply the label.
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: label1:
- example1/**/* - example/**/*
# Add 'label2' to any file changes within 'example2' folder
label2: example2/* 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" name: "Pull Request Labeler"
on: on:
@@ -33,3 +55,5 @@ jobs:
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" repo-token: "${{ secrets.GITHUB_TOKEN }}"
``` ```
_Note: This grants access to the `GITHUB_TOKEN` so the action can make calls to GitHub's rest API_