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 1/2] 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 8fac69316..94be23477 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; } From 5f9ce8480a2e1febc269b3167e86fd3bc45a09bf Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Fri, 1 Dec 2023 14:41:37 +0100 Subject: [PATCH 2/2] chore: rebuild action --- dist/cleanup/index.js | 4 +++- dist/setup/index.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index f302d0281..4fdc0fa31 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -90213,9 +90213,11 @@ function getGitHubHttpHeaders() { const token = core.getInput('token'); const auth = !token ? undefined : `token ${token}`; const headers = { - authorization: auth, accept: 'application/vnd.github.VERSION.raw' }; + if (auth) { + headers.authorization = auth; + } return headers; } exports.getGitHubHttpHeaders = getGitHubHttpHeaders; diff --git a/dist/setup/index.js b/dist/setup/index.js index a81030cf1..c2866154a 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -127471,9 +127471,11 @@ function getGitHubHttpHeaders() { const token = core.getInput('token'); const auth = !token ? undefined : `token ${token}`; const headers = { - authorization: auth, accept: 'application/vnd.github.VERSION.raw' }; + if (auth) { + headers.authorization = auth; + } return headers; } exports.getGitHubHttpHeaders = getGitHubHttpHeaders;