mirror of
https://github.com/actions/labeler.git
synced 2025-12-10 11:41:56 +00:00
Added output (#60)
* Added output * removed formatting changes * more formatting changes * Fix merge conflicts * Small test refactoring * tests are passing * Add a test * Add a small jest mock for addLabels. Not used. * Add tests for more cases * get rid of an unused jest mock * fix review points * rebuild + minor README fix * fix review points * update tests * fix formatting * add tests, fix bug * cleanup --------- Co-authored-by: Daniel Shteremberg <dshteremberg@labelbox.com> Co-authored-by: Daniel Shteremberg <Daniel@Daniel-Shterembergs-MacBook-Pro.local> Co-authored-by: Patrick Ellis <patrick.j.ellis@gmail.com> Co-authored-by: Andrey Lobanovich <andrei.lobanovich@akvelon.com>
This commit is contained in:
committed by
GitHub
parent
375538a703
commit
0967ca812e
50
README.md
50
README.md
@@ -109,12 +109,12 @@ jobs:
|
||||
|
||||
Various inputs are defined in [`action.yml`](action.yml) to let you configure the labeler:
|
||||
|
||||
| Name | Description | Default |
|
||||
| - | - | - |
|
||||
| `repo-token` | Token to use to authorize label changes. Typically the `GITHUB_TOKEN` secret, with `contents:read` and `pull-requests:write` access | `github.token` |
|
||||
| `configuration-path` | The path to the label configuration file | `.github/labeler.yml` |
|
||||
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false` |
|
||||
| `dot` | Whether or not to auto-include paths starting with dot (e.g. `.github`) | `false` |
|
||||
| Name | Description | Default |
|
||||
|----------------------|-------------------------------------------------------------------------------------------------|-----------------------|
|
||||
| `repo-token` | Token to use to authorize label changes. Typically the GITHUB_TOKEN secret | N/A |
|
||||
| `configuration-path` | The path to the label configuration file | `.github/labeler.yml` |
|
||||
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false` |
|
||||
| `dot` | Whether or not to auto-include paths starting with dot (e.g. `.github`) | `false` |
|
||||
|
||||
When `dot` is disabled and you want to include _all_ files in a folder:
|
||||
|
||||
@@ -131,6 +131,44 @@ label1:
|
||||
- path/to/folder/**
|
||||
```
|
||||
|
||||
#### Outputs
|
||||
|
||||
Labeler provides the following outputs:
|
||||
|
||||
| Name | Description |
|
||||
|--------------|-----------------------------------------------------------|
|
||||
| `new-labels` | A comma-separated list of all new labels |
|
||||
| `all-labels` | A comma-separated list of all labels that the PR contains |
|
||||
|
||||
The following example performs steps based on the output of labeler:
|
||||
```yml
|
||||
name: "My workflow"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- id: label-the-PR
|
||||
uses: actions/labeler@v3
|
||||
|
||||
- id: run-frontend-tests
|
||||
if: contains(fromJson(steps.label-the-PR.outputs.all-labels), 'frontend')
|
||||
run: |
|
||||
echo "Running frontend tests..."
|
||||
# Put your commands for running frontend tests here
|
||||
|
||||
- id: run-backend-tests
|
||||
if: contains(fromJson(steps.label-the-PR.outputs.all-labels), 'backend')
|
||||
run: |
|
||||
echo "Running backend tests..."
|
||||
# Put your commands for running backend tests here
|
||||
```
|
||||
|
||||
## Permissions
|
||||
|
||||
In order to add labels to pull requests, the GitHub labeler action requires
|
||||
|
||||
Reference in New Issue
Block a user