7b1d2aef87
Fixes #57 This PR implements the 3-step plan proposed by @gr2m in https://github.com/actions/create-github-app-token/issues/57#issuecomment-1751272252: > 1. Support both input types > 2. Log a deprecation warning for the old notation > 3. Add a test for deprecations Although this PR supports both input formats simultaneously, I opted _not_ to document the old format in the updated README. That’s a decision I’m happy to revisit, if y’all would prefer to have documentation for both the old and new formats.
32 lines
626 B
JavaScript
32 lines
626 B
JavaScript
// @ts-check
|
|
|
|
/**
|
|
* @param {import("@actions/core")} core
|
|
* @param {import("@octokit/request").request} request
|
|
*/
|
|
export async function post(core, request) {
|
|
const skipTokenRevoke = Boolean(
|
|
core.getInput("skip-token-revoke") || core.getInput("skip_token_revoke")
|
|
);
|
|
|
|
if (skipTokenRevoke) {
|
|
core.info("Token revocation was skipped");
|
|
return;
|
|
}
|
|
|
|
const token = core.getState("token");
|
|
|
|
if (!token) {
|
|
core.info("Token is not set");
|
|
return;
|
|
}
|
|
|
|
await request("DELETE /installation/token", {
|
|
headers: {
|
|
authorization: `token ${token}`,
|
|
},
|
|
});
|
|
|
|
core.info("Token revoked");
|
|
}
|