Skip to content

Commit ba790c8

Browse files
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
1 parent b333851 commit ba790c8

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,17 @@ jobs:
9999
runs-on: ubuntu-latest
100100
steps:
101101
- uses: actions/labeler@v4
102-
with:
103-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
104102
```
105103

106-
_Note: This grants access to the `GITHUB_TOKEN` so the action can make calls to GitHub's rest API_
107-
108104
#### Inputs
109105

110106
Various inputs are defined in [`action.yml`](action.yml) to let you configure the labeler:
111107

112108
| Name | Description | Default |
113109
| - | - | - |
114-
| `repo-token` | Token to use to authorize label changes. Typically the GITHUB_TOKEN secret, with `contents:read` and `pull-requests:write` access | N/A |
110+
| `repo-token` | Token to use to authorize label changes. Typically the GITHUB_TOKEN secret, with `contents:read` and `pull-requests:write` access | `github.token` |
115111
| `configuration-path` | The path to the label configuration file | `.github/labeler.yml` |
116-
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false`
112+
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false`|
117113

118114
# Contributions
119115

action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ description: 'Automatically label new pull requests based on the paths of files
33
author: 'GitHub'
44
inputs:
55
repo-token:
6-
description: 'The GITHUB_TOKEN secret'
6+
description: 'The GitHub token used to manage labels'
7+
required: false
8+
default: ${{ github.token }}
79
configuration-path:
810
description: 'The path for the label configurations'
911
default: '.github/labeler.yml'

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const minimatch_1 = __nccwpck_require__(3973);
4747
function run() {
4848
return __awaiter(this, void 0, void 0, function* () {
4949
try {
50-
const token = core.getInput('repo-token', { required: true });
50+
const token = core.getInput('repo-token');
5151
const configPath = core.getInput('configuration-path', { required: true });
5252
const syncLabels = !!core.getInput('sync-labels', { required: false });
5353
const prNumber = getPrNumber();

src/labeler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type ClientType = ReturnType<typeof github.getOctokit>;
1313

1414
export async function run() {
1515
try {
16-
const token = core.getInput('repo-token', {required: true});
16+
const token = core.getInput('repo-token');
1717
const configPath = core.getInput('configuration-path', {required: true});
1818
const syncLabels = !!core.getInput('sync-labels', {required: false});
1919

0 commit comments

Comments
 (0)