内网源

This commit is contained in:
2023-10-24 17:03:58 +08:00
parent 26961cf329
commit e88ea03761
2 changed files with 103 additions and 2 deletions

41
dist/setup/index.js vendored
View File

@@ -94136,6 +94136,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186));
const httpm = __importStar(__nccwpck_require__(6255));
const tc = __importStar(__nccwpck_require__(7784));
const path_1 = __importDefault(__nccwpck_require__(1017));
const base_distribution_1 = __importDefault(__nccwpck_require__(7));
@@ -94257,7 +94258,45 @@ class OfficialBuilds extends base_distribution_1.default {
}
getManifest() {
core.debug('Getting manifest from actions/node-versions@main');
return tc.getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main');
return this.getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main');
}
getManifestFromRepo(owner, repo, auth, branch = 'master') {
return __awaiter(this, void 0, void 0, function* () {
let releases = [];
const treeUrl = `https://gitea.icodef.com/api/v1/repos/${owner}/${repo}/git/trees/${branch}`;
const http = new httpm.HttpClient('tool-cache');
const headers = {};
if (auth) {
core.debug('set auth');
headers.authorization = auth;
}
const response = yield http.getJson(treeUrl, headers);
if (!response.result) {
return releases;
}
let manifestUrl = '';
for (const item of response.result.tree) {
if (item.path === 'versions-manifest.json') {
manifestUrl = item.url;
break;
}
}
headers['accept'] = 'application/vnd.github.VERSION.raw';
const versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
const base64 = JSON.parse(versionsRaw);
let tmp = Buffer.from(base64['content'], 'base64').toString('ascii');
if (tmp) {
// shouldn't be needed but protects against invalid json saved with BOM
tmp = tmp.replace(/^\uFEFF/, '');
try {
releases = JSON.parse(tmp);
}
catch (_a) {
core.debug('Invalid json');
}
}
return releases;
});
}
resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
var _a;