From 86039b0e748c2b4c365e7e10c1c2f434e75144ac Mon Sep 17 00:00:00 2001 From: Peter Murray <681306+peter-murray@users.noreply.github.com> Date: Fri, 17 Nov 2023 12:11:45 +0000 Subject: [PATCH] Fixing issues with the handling of the token and avoiding error on when the token is undefined --- src/util.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index 8fac6931..94be2347 100644 --- a/src/util.ts +++ b/src/util.ts @@ -166,9 +166,13 @@ export function convertVersionToSemver(version: number[] | string) { export function getGitHubHttpHeaders(): OutgoingHttpHeaders { const token = core.getInput('token'); const auth = !token ? undefined : `token ${token}`; + const headers: OutgoingHttpHeaders = { - authorization: auth, accept: 'application/vnd.github.VERSION.raw' }; + + if (auth) { + headers.authorization = auth; + } return headers; }