From a685911c7bd09442323e7ee2e2b06c80a523ff40 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 20 Jun 2024 03:11:42 +0200 Subject: [PATCH] update dist --- dist/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index e326a84..29a4530 100644 --- a/dist/index.js +++ b/dist/index.js @@ -278,7 +278,7 @@ function action(_actionName, params, core) { //When it's a normal branch: github.head_ref==="" and github.ref==="refs/heads/main" //When it's a pr from: github.head_ref==="" const branch = params.branch.replace(/^refs\/heads\//, ""); - const to_version = yield getPackageJsonVersion({ owner, repo, branch }); + const to_version = yield getPackageJsonVersion({ owner, repo, branch, github_token }); if (to_version === undefined) { throw new Error(`No version in package.json on ${owner}/${repo}#${branch} (or repo is private)`); } @@ -320,8 +320,12 @@ exports.action = action; //TODO: Find a way to make it work with private repo function getPackageJsonVersion(params) { return __awaiter(this, void 0, void 0, function* () { - const { owner, repo, branch } = params; - const version = yield node_fetch_1.default(urlJoin(`https://raw.github.com`, owner, repo, branch, "package.json")) + const { owner, repo, branch, github_token } = params; + const version = yield node_fetch_1.default(urlJoin(`https://raw.github.com`, owner, repo, branch, "package.json"), { + "headers": { + "Authorization": `token ${github_token}` + } + }) .then(res => res.text()) .then(text => JSON.parse(text)) .then(({ version }) => version)