Skip to content

Commit

Permalink
fixup! Try revoking token
Browse files Browse the repository at this point in the history
  • Loading branch information
tibdex committed Sep 9, 2023
1 parent b69f2b8 commit b69f4b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
- name: Revoke token
env:
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}

run: >-
gh api --header "X-GitHub-Api-Version: 2022-11-28" --method DELETE /installation/token
- name: Revoke token (again)
env:
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
run: >-
gh api --header "X-GitHub-Api-Version: 2022-11-28" --method DELETE /installation/token
- run: node --eval "assert('${{ steps.create_token.outputs.token }}'.length > 0);"
if: ${{ steps.create_token.outcome != 'skipped' }}
6 changes: 4 additions & 2 deletions src/create-installation-access-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ export const createInstallationAccessToken = async ({
debug(`Retrieved installation ID: ${installationId}.`);

try {

const {
data: { token },
} = await octokit.request("POST /app/installations/{installation_id}/access_tokens", {installation_id: installationId, permissions, repositories});
} = await octokit.request(
"POST /app/installations/{installation_id}/access_tokens",
{ installation_id: installationId, permissions, repositories },
);
return token;
} catch (error: unknown) {
throw new Error("Could not create installation access token.", {
Expand Down

0 comments on commit b69f4b9

Please sign in to comment.