fix 'github-actions[bot]' usage
This commit is contained in:
Родитель
365f527f8a
Коммит
8883a56cb4
|
@ -79,6 +79,7 @@ Here are the configuration options for this Action:
|
|||
| Input | Required? | Default | Description |
|
||||
|-----------| --------- |---------------------------------------------| ----------- |
|
||||
| `github_token` | yes | `${{ github.token }}` | The GitHub token used to create an authenticated client - Provided for you by default! - You can use the default provided token or you can provide a PAT as an alternative robot user token. Make sure this is a repository scoped token |
|
||||
| `handle` | yes | `github-actions[bot]` | When using the default `${{ github.token }}` (as seen above), the "handle" is fetched from this input since the token is repository scoped and it cannot even read its own handle. You should not need to change this input. |
|
||||
| `path` | yes | `config/privileged-requester.yaml` | Path where the privileged requester configuration can be found |
|
||||
| `prCreator` | yes | `${{ github.event.pull_request.user.login }}` | The creator of the PR for this pull request event |
|
||||
| `prNumber` | yes | `${{ github.event.pull_request.number }}` | The number of the PR for this pull request event |
|
||||
|
|
|
@ -11,6 +11,10 @@ inputs:
|
|||
You can use the default provided token or you can provide a PAT as an alternative robot user token
|
||||
required: true
|
||||
default: ${{ github.token }}
|
||||
handle:
|
||||
description: 'When using the default ${{ github.token }}, the "handle" is fetched from this input since the token is repository scoped and it cannot even read its own handle. You should not need to change this input.'
|
||||
required: true
|
||||
default: github-actions[bot]
|
||||
path:
|
||||
description: 'Path where the privileged requester configuration can be found'
|
||||
required: true
|
||||
|
|
|
@ -37679,14 +37679,13 @@ class GitHubProvider {
|
|||
} catch (error) {
|
||||
core.debug(error);
|
||||
core.debug(
|
||||
`octokit.rest.users.getAuthenticated() failed, trying with octokit.rest.apps.getAuthenticated() instead`,
|
||||
`octokit.rest.users.getAuthenticated() failed, assuming the default input GITHUB_TOKEN is a github-actions[bot] token`,
|
||||
);
|
||||
const { data: currentApp } =
|
||||
await this.octokit.rest.apps.getAuthenticated();
|
||||
login = currentApp.slug;
|
||||
core.debug(
|
||||
"obtained current user via octokit.rest.apps.getAuthenticated()",
|
||||
`since the GITHUB_TOKEN might be 'github-actions[bot]' we will use the default input option of 'handle' instead`,
|
||||
);
|
||||
login = core.getInput("handle", { required: true });
|
||||
core.debug(`handle value: ${login}`);
|
||||
}
|
||||
|
||||
core.debug(`current user: ${login}`);
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -25,14 +25,13 @@ class GitHubProvider {
|
|||
} catch (error) {
|
||||
core.debug(error);
|
||||
core.debug(
|
||||
`octokit.rest.users.getAuthenticated() failed, trying with octokit.rest.apps.getAuthenticated() instead`,
|
||||
`octokit.rest.users.getAuthenticated() failed, assuming the default input GITHUB_TOKEN is a github-actions[bot] token`,
|
||||
);
|
||||
const { data: currentApp } =
|
||||
await this.octokit.rest.apps.getAuthenticated();
|
||||
login = currentApp.slug;
|
||||
core.debug(
|
||||
"obtained current user via octokit.rest.apps.getAuthenticated()",
|
||||
`since the GITHUB_TOKEN might be 'github-actions[bot]' we will use the default input option of 'handle' instead`,
|
||||
);
|
||||
login = core.getInput("handle", { required: true });
|
||||
core.debug(`handle value: ${login}`);
|
||||
}
|
||||
|
||||
core.debug(`current user: ${login}`);
|
||||
|
|
Загрузка…
Ссылка в новой задаче