Skip to content

Commit

Permalink
Hello?
Browse files Browse the repository at this point in the history
  • Loading branch information
hyzyla committed Sep 1, 2023
1 parent 75545de commit 607c21a
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions scripts/check-updates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { execSync } from "child_process";
import { promises as fs } from "fs";
import axios from "axios";
import { createGunzip } from "zlib";
import { extract } from "tar";
import { extract, t } from "tar";
import { pipeline as _pipeline } from "stream";
import { promisify } from "util";

Expand Down Expand Up @@ -44,14 +44,24 @@ async function checkForUpdates() {
execSync(`git switch -c ${branchName}`);

// check if branch exists
const { data: branch } = await octokit.repos.getBranch({
owner: "hyzyla",
repo: "pdfium",
branch: branchName,
});
if (branch) {
console.log(`Branch ${branchName} already exists`);
return;
try {
const { data: branch } = await octokit.repos.getBranch({
owner: "hyzyla",
repo: "pdfium",
branch: branchName,
request: {
validate: false,
},
});
if (branch) {
console.log(`Branch ${branchName} already exists`);
return;
}
} catch (e) {
if (e.status === 404) {
console.log(`Branch ${branchName} does not exist`);
}
throw e;
}

try {
Expand Down

0 comments on commit 607c21a

Please sign in to comment.