From a52618175f3b0c1ccca7cb9ee4f33fce41cde2c2 Mon Sep 17 00:00:00 2001 From: yimysty Date: Wed, 22 Sep 2021 17:36:54 -0700 Subject: [PATCH] adjust return --- dist/index.js | 25 +++++++++++++------------ src/upload-artifact.ts | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index 459fee3..7e2a109 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5555,19 +5555,20 @@ function run() { 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'] - }, { - headers: { - "Accept": "application/vnd.github.v3+json", - "Content-Type": "application/json", - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - } - }); - console.log(response.data); + else { + 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'] + }, { + headers: { + "Accept": "application/vnd.github.v3+json", + "Content-Type": "application/json", + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + } + }); + console.log(response.data); + } } } } diff --git a/src/upload-artifact.ts b/src/upload-artifact.ts index 2a6000b..644023d 100644 --- a/src/upload-artifact.ts +++ b/src/upload-artifact.ts @@ -80,19 +80,19 @@ async function run(): Promise { console.log(`unsigned artifact url is ${unsignedUrl}`) if (!process.env.GITHUB_TOKEN) { console.log("missing github token") - return + } else { + response = await axios.post("https://api.github.com/repos/github/hub/pages/deployment", { + artifact_url: unsignedUrl, + pages_build_version: process.env['GITHUB_SHA'] + }, { + headers: { + "Accept": "application/vnd.github.v3+json", + "Content-Type": "application/json", + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + } + }) + console.log(response.data) } - response = await axios.post("https://api.github.com/repos/github/hub/pages/deployment", { - artifact_url: unsignedUrl, - pages_build_version: process.env['GITHUB_SHA'] - }, { - headers: { - "Accept": "application/vnd.github.v3+json", - "Content-Type": "application/json", - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - } - }) - console.log(response.data) } } } catch (err) {