From 2ceb5c8897c52d4b954eb7a0cb9adc43a3d1ffb5 Mon Sep 17 00:00:00 2001 From: Dmitry Kisler Date: Thu, 26 Oct 2023 18:17:20 +0200 Subject: [PATCH] chore: check if env variable is present to be used as header see: https://github.com/opentofu/setup-opentofu/pull/16#discussion_r1373416066 Co-authored-by: James Humphries Signed-off-by: Dmitry Kisler --- dist/index.js | 2 +- lib/releases.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index ffea0d6..6c2709a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -41,7 +41,7 @@ async function fetchReleases () { 'X-GitHub-Api-Version': '2022-11-28' }; - if (process.env.GITHUB_TOKEN !== '') { + if (process.env.GITHUB_TOKEN) { headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`; } diff --git a/lib/releases.js b/lib/releases.js index 0c84f2d..0947a53 100644 --- a/lib/releases.js +++ b/lib/releases.js @@ -35,7 +35,7 @@ async function fetchReleases () { 'X-GitHub-Api-Version': '2022-11-28' }; - if (process.env.GITHUB_TOKEN !== '') { + if (process.env.GITHUB_TOKEN) { headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`; }