Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 7064f48

Browse files
authored
Merge pull request #21 from thepwagner/revoke-the-revocable
only save/revoke "revocable" tokens
2 parents 1146b69 + 414987d commit 7064f48

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

dist/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ async function run() {
6363
core.info(`Sending request: ${tokenReq}`);
6464
const res = await http.post(server, tokenReq);
6565
const body = await res.readBody();
66-
const token = JSON.parse(body)['token'];
66+
const parsed = JSON.parse(body);
67+
const token = parsed['token'];
6768
if (!token) {
6869
throw new Error('no token');
6970
}
7071
core.setSecret(token);
7172
core.setOutput('token', token);
72-
state.saveToken(token);
73+
if (parsed['revocable']) {
74+
state.saveToken(token);
75+
}
7376
}
7477
catch (error) {
7578
if (error instanceof Error)

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ async function run(): Promise<void> {
3232
const res = await http.post(server, tokenReq)
3333

3434
const body = await res.readBody()
35-
const token = JSON.parse(body)['token'] as string
35+
const parsed = JSON.parse(body)
36+
const token = parsed['token'] as string
3637
if (!token) {
3738
throw new Error('no token')
3839
}
3940
core.setSecret(token)
4041
core.setOutput('token', token)
41-
state.saveToken(token)
42+
if (parsed['revocable']) {
43+
state.saveToken(token)
44+
}
4245
} catch (error) {
4346
if (error instanceof Error) core.setFailed(error.message)
4447
}

0 commit comments

Comments
 (0)