return if no github token

This commit is contained in:
yimysty 2021-09-22 17:34:57 -07:00
parent 56f7cd9914
commit 846d13ffe4
2 changed files with 10 additions and 2 deletions

6
dist/index.js vendored
View file

@ -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);

View file

@ -78,6 +78,10 @@ async function run(): Promise<void> {
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<void> {
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)