Default reaction-token to github.token

This commit is contained in:
Peter Evans
2020-06-02 15:39:20 +09:00
parent 6181a5a6d8
commit 9d99b44062
5 changed files with 49 additions and 1068 deletions
@@ -18,7 +18,6 @@ jobs:
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
commands: hello-world-local, ping-local
permission: none
issue-type: issue
@@ -28,7 +27,6 @@ jobs:
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
config: >
[
{
@@ -95,6 +93,5 @@ jobs:
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
reactions: false
config-from-file: .github/slash-command-dispatch.json
+5 -4
View File
@@ -64,7 +64,7 @@ This action also features [advanced configuration](docs/advanced-configuration.m
| Input | Description | Default |
| --- | --- | --- |
| `token` | (**required**) A `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). Note: `GITHUB_TOKEN` *does not* work here. See [token](#token) for further details. | |
| `reaction-token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). See [reaction-token](#reaction-token) for further details. | Value of input `token` |
| `reaction-token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). See [reaction-token](#reaction-token) for further details. | `GITHUB_TOKEN` |
| `reactions` | Add reactions. :eyes: = seen, :rocket: = dispatched | `true` |
| `commands` | (**required**) A comma separated list of commands. | |
| `permission` | The repository permission level required by the user to dispatch commands. (`none`, `read`, `write`, `admin`) | `write` |
@@ -84,15 +84,16 @@ If you will be dispatching commands to public repositories *only* then you can u
#### `reaction-token`
If you don't specify a token for `reaction-token` it will use the [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) supplied via `token`.
This means that reactions to comments will appear to be made by the user account associated with the PAT. If you prefer to have the @github-actions bot user react to comments you can set `reaction-token` to `GITHUB_TOKEN`.
If you don't specify a token for `reaction-token` it will use the default `GITHUB_TOKEN`.
Reactions to comments will then be made by the @github-actions bot user.
You can use a [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) if you would prefer reactions to be made by the user account associated with the PAT.
```yml
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
reaction-token: ${{ secrets.REPO_ACCESS_TOKEN }}
commands: deploy, integration-test, build-docs
```
+1
View File
@@ -6,6 +6,7 @@ inputs:
required: true
reaction-token:
description: 'An optional GitHub token to use for reactions.'
default: ${{ github.token }}
reactions:
description: 'Add reactions to comments containing commands.'
commands:
+42 -1058
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -99,9 +99,7 @@ async function run() {
// Set octokit clients
const octokit = new github.GitHub(inputs.token);
const reactionOctokit = inputs.reactionToken
? new github.GitHub(inputs.reactionToken)
: new github.GitHub(inputs.token);
const reactionOctokit = new github.GitHub(inputs.reactionToken)
// At this point we know the command is registered
// Add the "eyes" reaction to the comment