feat: Add a skip_token_revoke input for configuring token revocation (#54)
Fixes https://github.com/actions/create-github-app-token/issues/55 Currently, `actions/create-github-app-token` always/unconditionally revokes the installation access token in a `post` step, at the completion of the current job. This prevents tokens from being used in other jobs. This PR makes this behavior configurable: - When the `skip-token-revoke` input is not specified (i.e. by default), the token is revoked in a `post` step (i.e. the current behavior). - When the `skip-token-revoke` input is set to a truthy value (e.g. `"true"`[^1]), the token is not revoked in a `post` step. This PR adds a test for the `skip-token-revoke: "true"` case. This is configurable in other app token actions, e.g. [tibdex/github-app-token](3eb77c7243/README.md (L46-L47)) and [wow-actions/use-app-token](cd772994fc/README.md (L132)). [^1]: Note that `"false"` is also truthy: `Boolean("false")` is `true`. If we think that’ll potentially confuse folks, I can require `skip-token-revoke` to be set explicitly to `"true"`.
This commit is contained in:
5
main.js
5
main.js
@@ -19,6 +19,8 @@ const privateKey = core.getInput("private_key");
|
||||
const owner = core.getInput("owner");
|
||||
const repositories = core.getInput("repositories");
|
||||
|
||||
const skipTokenRevoke = Boolean(core.getInput("skip_token_revoke"));
|
||||
|
||||
main(
|
||||
appId,
|
||||
privateKey,
|
||||
@@ -28,7 +30,8 @@ main(
|
||||
createAppAuth,
|
||||
request.defaults({
|
||||
baseUrl: process.env["GITHUB_API_URL"],
|
||||
})
|
||||
}),
|
||||
skipTokenRevoke
|
||||
).catch((error) => {
|
||||
console.error(error);
|
||||
core.setFailed(error.message);
|
||||
|
||||
Reference in New Issue
Block a user