Skip to content

Commit 3eb77c7

Browse files
authored
Add option to not revoke token (#95)
1 parent 9571738 commit 3eb77c7

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
# repositories: >-
4444
# ["actions/toolkit", "github/docs"]
4545

46+
# Optional.
47+
# revoke: false
48+
4649
- run: "echo 'The created token is masked: ${{ steps.create_token.outputs.token }}'"
4750
```
4851

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ inputs:
4141
The JSON-stringified array of the full names of the repositories the token should have access to.
4242
Defaults to all repositories that the installation can access.
4343
See https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app's `repositories`.
44+
revoke:
45+
description: Revoke the token at the end of the job.
46+
default: true
4447
outputs:
4548
token:
4649
description: An installation access token for the GitHub App.

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-app-token",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"license": "MIT",
55
"type": "module",
66
"files": [
@@ -16,7 +16,7 @@
1616
"typecheck": "tsc --build"
1717
},
1818
"dependencies": {
19-
"@actions/core": "^1.10.0",
19+
"@actions/core": "^1.10.1",
2020
"@actions/github": "^5.1.1",
2121
"@octokit/auth-app": "^6.0.0",
2222
"@octokit/request": "^8.1.1",
@@ -25,7 +25,7 @@
2525
"devDependencies": {
2626
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
2727
"@types/is-base64": "^1.1.1",
28-
"@types/node": "^20.6.0",
28+
"@types/node": "^20.6.2",
2929
"@vercel/ncc": "^0.38.0",
3030
"prettier": "^3.0.3",
3131
"prettier-plugin-packagejson": "^2.4.5",

src/post.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
import { getState, info } from "@actions/core";
1+
import { getInput, getState, info } from "@actions/core";
22

33
import { revokeInstallationAccessToken } from "./revoke-installation-access-token.js";
44
import { run } from "./run.js";
55
import { tokenKey } from "./state.js";
66

77
await run(async () => {
8+
if (!JSON.parse(getInput("revoke"))) {
9+
info("Token revocation skipped");
10+
return;
11+
}
12+
813
const token = getState(tokenKey);
914
if (!token) {
1015
info("No token to revoke");

0 commit comments

Comments
 (0)