Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not revoke token if already expired #147

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39753,7 +39753,7 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp
core3.setOutput("app-slug", appSlug);
if (!skipTokenRevoke2) {
core3.saveState("token", authentication.token);
core3.setOutput("expiresAt", authentication.expiresAt);
core3.saveState("expiresAt", authentication.expiresAt);
}
}
async function getTokenFromOwner(request2, auth5, parsedOwner) {
Expand Down
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function main(
// Make token accessible to post function (so we can invalidate it)
if (!skipTokenRevoke) {
core.saveState("token", authentication.token);
core.setOutput("expiresAt", authentication.expiresAt);
core.saveState("expiresAt", authentication.expiresAt);
}
}

Expand Down
27 changes: 9 additions & 18 deletions tests/snapshots/index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-missing-app-id.test.js

Expand Down Expand Up @@ -94,8 +93,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-set-repo-set-to-many.test.js

Expand All @@ -114,8 +112,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-set-repo-set-to-one.test.js

Expand All @@ -134,8 +131,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-set-to-org-repo-unset.test.js

Expand All @@ -154,8 +150,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-set-to-user-fail-response.test.js

Expand All @@ -175,8 +170,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-set-to-user-repo-unset.test.js

Expand All @@ -195,8 +189,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-unset-repo-set.test.js

Expand All @@ -215,8 +208,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## main-token-get-owner-unset-repo-unset.test.js

Expand All @@ -235,8 +227,7 @@ Generated by [AVA](https://avajs.dev).
::set-output name=app-slug::github-actions␊
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
::set-output name=expiresAt::2016-07-11T22:14:10Z`
::save-state name=expiresAt::2016-07-11T22:14:10Z`

## post-revoke-token-fail-response.test.js

Expand Down
Binary file modified tests/snapshots/index.js.snap
Binary file not shown.