From 846d13ffe4fa59f53fdfdacf7119ca7d84b28ee2 Mon Sep 17 00:00:00 2001 From: yimysty Date: Wed, 22 Sep 2021 17:34:57 -0700 Subject: [PATCH] return if no github token --- dist/index.js | 6 +++++- src/upload-artifact.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index b84ed87..459fee3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5553,6 +5553,10 @@ function run() { const unsignedUrl = `${response.data.value[0].url}`; console.log(response.data); console.log(`unsigned artifact url is ${unsignedUrl}`); + if (!process.env.GITHUB_TOKEN) { + console.log("missing github token"); + return; + } response = yield axios_1.default.post("https://api.github.com/repos/github/hub/pages/deployment", { artifact_url: unsignedUrl, pages_build_version: process.env['GITHUB_SHA'] @@ -5560,7 +5564,7 @@ function run() { headers: { "Accept": "application/vnd.github.v3+json", "Content-Type": "application/json", - "Authorization": `Bearer ${process.env['GITHUB_TOKEN']}` + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` } }); console.log(response.data); diff --git a/src/upload-artifact.ts b/src/upload-artifact.ts index b7badef..2a6000b 100644 --- a/src/upload-artifact.ts +++ b/src/upload-artifact.ts @@ -78,6 +78,10 @@ async function run(): Promise { const unsignedUrl = `${response.data.value[0].url}` console.log(response.data) console.log(`unsigned artifact url is ${unsignedUrl}`) + if (!process.env.GITHUB_TOKEN) { + console.log("missing github token") + return + } response = await axios.post("https://api.github.com/repos/github/hub/pages/deployment", { artifact_url: unsignedUrl, pages_build_version: process.env['GITHUB_SHA'] @@ -85,7 +89,7 @@ async function run(): Promise { headers: { "Accept": "application/vnd.github.v3+json", "Content-Type": "application/json", - "Authorization": `Bearer ${process.env['GITHUB_TOKEN']}` + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` } }) console.log(response.data)