feat: default repo-token to github.token (#227)

* feat: default `repo-token` to `github.token`

* Update README.md

* Update labeler.ts

* Update index.js

* Update action.yml

* Update dist/index.js

* Update index.js

* Update dist/index.js
This commit is contained in:
Michaël De Boey
2023-03-07 12:25:56 +01:00
committed by GitHub
parent b3338513be
commit ba790c862c
4 changed files with 7 additions and 9 deletions

View File

@@ -99,21 +99,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
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_
#### Inputs
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 | N/A |
| `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`
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false`|
# Contributions

View File

@@ -3,7 +3,9 @@ description: 'Automatically label new pull requests based on the paths of files
author: 'GitHub'
inputs:
repo-token:
description: 'The GITHUB_TOKEN secret'
description: 'The GitHub token used to manage labels'
required: false
default: ${{ github.token }}
configuration-path:
description: 'The path for the label configurations'
default: '.github/labeler.yml'

2
dist/index.js vendored
View File

@@ -47,7 +47,7 @@ const minimatch_1 = __nccwpck_require__(3973);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const token = core.getInput('repo-token', { required: true });
const token = core.getInput('repo-token');
const configPath = core.getInput('configuration-path', { required: true });
const syncLabels = !!core.getInput('sync-labels', { required: false });
const prNumber = getPrNumber();

View File

@@ -13,7 +13,7 @@ type ClientType = ReturnType<typeof github.getOctokit>;
export async function run() {
try {
const token = core.getInput('repo-token', {required: true});
const token = core.getInput('repo-token');
const configPath = core.getInput('configuration-path', {required: true});
const syncLabels = !!core.getInput('sync-labels', {required: false});