From 2540ed49e5d6bea751bf3da363bb5b5a6fcf0c07 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 28 Aug 2023 15:14:31 -0700 Subject: [PATCH] fix: check for token before revoking (#30) Check before trying to revoke the token, in case the token generation failed. Otherwise the post step will throw an error. --------- Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com> --- lib/post.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/post.js b/lib/post.js index 2e0319f..a0efe15 100644 --- a/lib/post.js +++ b/lib/post.js @@ -10,6 +10,8 @@ import { request } from "@octokit/request"; export async function post(core, request) { const token = core.getState("token"); + if (!token) return; + await request("DELETE /installation/token", { headers: { authorization: `token ${token}`,