Skip to content

Commit 30a43c8

Browse files
committed
fix: Rename input, from 'revoke' to 'skip-token-revoke'
1 parent 0097d3d commit 30a43c8

File tree

10 files changed

+19
-28
lines changed

10 files changed

+19
-28
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ jobs:
145145
> [!NOTE]
146146
> If `owner` is set and `repositories` is empty, access will be scoped to all repositories in the provided repository owner's installation. If `owner` and `repositories` are empty, access will be scoped to only the current repository.
147147

148-
### `revoke`
148+
### `skip-token-revoke`
149149

150-
**Optional:** Whether to revoke the token when the current job is complete. Default: `"true"`.
150+
**Optional:** If truthy, the token will not be revoked when the current job is complete.
151151

152152
## Outputs
153153

@@ -162,7 +162,7 @@ The action creates an installation access token using [the `POST /app/installati
162162
1. The token is scoped to the current repository or `repositories` if set.
163163
2. The token inherits all the installation's permissions.
164164
3. The token is set as output `token` which can be used in subsequent steps.
165-
4. Unless `revoke: "false"` is set, the token is revoked in the `post` step of the action, which means it cannot be passed to another job.
165+
4. Unless the `skip-token-revoke` input is set to a truthy value, the token is revoked in the `post` step of the action, which means it cannot be passed to another job.
166166
5. The token is masked, it cannot be logged accidentally.
167167

168168
> [!NOTE]

action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ inputs:
1717
repositories:
1818
description: "Repositories to install the GitHub App on (defaults to current repository if owner is unset)"
1919
required: false
20-
revoke:
21-
description: "Whether to revoke the token when the current job is complete"
20+
skip-token-revoke:
21+
description: "If truthy, the token will not be revoked when the current job is complete"
2222
required: false
23-
default: "true"
2423
outputs:
2524
token:
2625
description: "GitHub installation access token"

dist/main.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15043,7 +15043,7 @@ var import_core = __toESM(require_core(), 1);
1504315043
var import_auth_app = __toESM(require_dist_node12(), 1);
1504415044

1504515045
// lib/main.js
15046-
async function main(appId2, privateKey2, owner2, repositories2, core2, createAppAuth2, request2, revoke2) {
15046+
async function main(appId2, privateKey2, owner2, repositories2, core2, createAppAuth2, request2, skipTokenRevoke2) {
1504715047
let parsedOwner = "";
1504815048
let parsedRepositoryNames = "";
1504915049
if (!owner2 && !repositories2) {
@@ -15119,7 +15119,7 @@ async function main(appId2, privateKey2, owner2, repositories2, core2, createApp
1511915119
}
1512015120
core2.setSecret(authentication.token);
1512115121
core2.setOutput("token", authentication.token);
15122-
if (revoke2) {
15122+
if (!skipTokenRevoke2) {
1512315123
core2.saveState("token", authentication.token);
1512415124
}
1512515125
}
@@ -15144,7 +15144,7 @@ var appId = import_core.default.getInput("app_id");
1514415144
var privateKey = import_core.default.getInput("private_key");
1514515145
var owner = import_core.default.getInput("owner");
1514615146
var repositories = import_core.default.getInput("repositories");
15147-
var revoke = import_core.default.getInput("revoke") === "true";
15147+
var skipTokenRevoke = Boolean(import_core.default.getInput("skip-token-revoke"));
1514815148
main(
1514915149
appId,
1515015150
privateKey,
@@ -15155,7 +15155,7 @@ main(
1515515155
request_default.defaults({
1515615156
baseUrl: process.env["GITHUB_API_URL"]
1515715157
}),
15158-
revoke
15158+
skipTokenRevoke
1515915159
).catch((error) => {
1516015160
console.error(error);
1516115161
import_core.default.setFailed(error.message);

dist/post.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,8 +2955,8 @@ var import_core = __toESM(require_core(), 1);
29552955

29562956
// lib/post.js
29572957
async function post(core2, request2) {
2958-
const revoke = core2.getInput("revoke") === "true";
2959-
if (!revoke) {
2958+
const skipTokenRevoke = Boolean(core2.getInput("skip-token-revoke"));
2959+
if (skipTokenRevoke) {
29602960
core2.info("Token revocation was skipped");
29612961
return;
29622962
}

lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @param {import("@actions/core")} core
99
* @param {import("@octokit/auth-app").createAppAuth} createAppAuth
1010
* @param {import("@octokit/request").request} request
11-
* @param {boolean} revoke
11+
* @param {boolean} skipTokenRevoke
1212
*/
1313
export async function main(
1414
appId,
@@ -18,7 +18,7 @@ export async function main(
1818
core,
1919
createAppAuth,
2020
request,
21-
revoke
21+
skipTokenRevoke
2222
) {
2323
let parsedOwner = "";
2424
let parsedRepositoryNames = "";
@@ -124,7 +124,7 @@ export async function main(
124124
core.setOutput("token", authentication.token);
125125

126126
// Make token accessible to post function (so we can invalidate it)
127-
if (revoke) {
127+
if (!skipTokenRevoke) {
128128
core.saveState("token", authentication.token);
129129
}
130130
}

lib/post.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* @param {import("@octokit/request").request} request
66
*/
77
export async function post(core, request) {
8-
const revoke = core.getInput("revoke") === "true";
8+
const skipTokenRevoke = Boolean(core.getInput("skip-token-revoke"));
99

10-
if (!revoke) {
10+
if (skipTokenRevoke) {
1111
core.info("Token revocation was skipped");
1212
return;
1313
}

main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const privateKey = core.getInput("private_key");
1919
const owner = core.getInput("owner");
2020
const repositories = core.getInput("repositories");
2121

22-
const revoke = core.getInput("revoke") === "true";
22+
const skipTokenRevoke = Boolean(core.getInput("skip-token-revoke"));
2323

2424
main(
2525
appId,
@@ -31,7 +31,7 @@ main(
3131
request.defaults({
3232
baseUrl: process.env["GITHUB_API_URL"],
3333
}),
34-
revoke
34+
skipTokenRevoke
3535
).catch((error) => {
3636
console.error(error);
3737
core.setFailed(error.message);

tests/post-token-set.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import { MockAgent, setGlobalDispatcher } from "undici";
44
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
55
process.env.STATE_token = "secret123";
66

7-
// inputs are set as environment variables with the prefix INPUT_
8-
// https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
9-
process.env.INPUT_REVOKE = "true";
10-
117
const mockAgent = new MockAgent();
128

139
setGlobalDispatcher(mockAgent);

tests/post-token-skipped.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ process.env.STATE_token = "secret123";
66

77
// inputs are set as environment variables with the prefix INPUT_
88
// https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
9-
process.env.INPUT_REVOKE = "false";
9+
process.env["INPUT_SKIP-TOKEN-REVOKE"] = "true";
1010

1111
const mockAgent = new MockAgent();
1212

tests/post-token-unset.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@
22
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
33
delete process.env.STATE_token;
44

5-
// inputs are set as environment variables with the prefix INPUT_
6-
// https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
7-
process.env.INPUT_REVOKE = "true";
8-
95
await import("../post.js");

0 commit comments

Comments
 (0)