mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
Fix previous feat
This commit is contained in:
parent
a685911c7b
commit
42b51ab7b0
3 changed files with 33 additions and 20 deletions
7
dist/index.js
vendored
7
dist/index.js
vendored
|
|
@ -321,12 +321,15 @@ exports.action = action;
|
|||
function getPackageJsonVersion(params) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { owner, repo, branch, github_token } = params;
|
||||
const version = yield node_fetch_1.default(urlJoin(`https://raw.github.com`, owner, repo, branch, "package.json"), {
|
||||
const version = yield node_fetch_1.default(`https://api.github.com/repos/${owner}/${repo}/contents/package.json?ref=${branch}`, {
|
||||
"headers": {
|
||||
"Authorization": `token ${github_token}`
|
||||
}
|
||||
})
|
||||
.then(res => res.text())
|
||||
.then((res) => __awaiter(this, void 0, void 0, function* () {
|
||||
const { content } = JSON.parse(yield res.text());
|
||||
return Buffer.from(content, "base64").toString("utf-8");
|
||||
}))
|
||||
.then(text => JSON.parse(text))
|
||||
.then(({ version }) => version)
|
||||
.catch(() => undefined);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue