mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
update dist
This commit is contained in:
parent
9356720963
commit
a685911c7b
1 changed files with 7 additions and 3 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
|
@ -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==="<name of the branch branch>"
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue