fix 'github-actions[bot]' usage

This commit is contained in:
GrantBirki 2023-11-28 13:37:00 -07:00
Родитель 365f527f8a
Коммит 8883a56cb4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9029BBCCC15C6F8C
5 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -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

9
dist/index.js сгенерированный поставляемый
Просмотреть файл

@ -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}`);

2
dist/index.js.map сгенерированный поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -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}`);