mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-03-13 14:30:15 +08:00
add create reference to make tree accessible
This commit is contained in:
parent
e0f3e8c4a3
commit
038296d909
22
dist/cleanup/index.js
generated
vendored
22
dist/cleanup/index.js
generated
vendored
@ -74451,8 +74451,9 @@ function generateReports() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
||||||
(0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
|
yield (0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
|
||||||
(0, utils_1.createTree)(JSON.stringify(buildOutput));
|
const treeSha = yield (0, utils_1.createTree)(JSON.stringify(buildOutput));
|
||||||
|
yield (0, utils_1.createRef)(treeSha);
|
||||||
const report = createReport(buildOutput);
|
const report = createReport(buildOutput);
|
||||||
if (areJobReportsEnabled()) {
|
if (areJobReportsEnabled()) {
|
||||||
core.summary.addRaw(report);
|
core.summary.addRaw(report);
|
||||||
@ -74758,7 +74759,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.createTree = exports.saveReportJson = exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getLatestRelease = exports.exec = void 0;
|
exports.createTree = exports.createRef = exports.saveReportJson = exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getLatestRelease = exports.exec = void 0;
|
||||||
const c = __importStar(__nccwpck_require__(2764));
|
const c = __importStar(__nccwpck_require__(2764));
|
||||||
const core = __importStar(__nccwpck_require__(2258));
|
const core = __importStar(__nccwpck_require__(2258));
|
||||||
const github = __importStar(__nccwpck_require__(7168));
|
const github = __importStar(__nccwpck_require__(7168));
|
||||||
@ -74899,6 +74900,9 @@ exports.isPREvent = isPREvent;
|
|||||||
function getGitHubToken() {
|
function getGitHubToken() {
|
||||||
return core.getInput(c.INPUT_GITHUB_TOKEN);
|
return core.getInput(c.INPUT_GITHUB_TOKEN);
|
||||||
}
|
}
|
||||||
|
function getCommitSha() {
|
||||||
|
return process.env.GITHUB_SHA || "default_tag";
|
||||||
|
}
|
||||||
function createPRComment(content) {
|
function createPRComment(content) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@ -74948,6 +74952,18 @@ function saveReportJson(content) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.saveReportJson = saveReportJson;
|
exports.saveReportJson = saveReportJson;
|
||||||
|
function createRef(sha) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const ref = `refs/metrics/` + getCommitSha();
|
||||||
|
console.log(`creating ref ${ref} for metrics tree ${sha}`);
|
||||||
|
const octokit = github.getOctokit(getGitHubToken());
|
||||||
|
const context = github.context;
|
||||||
|
const response = yield octokit.request(`POST /repos/${context.repo.owner}/${context.repo.repo}/git/refs`, Object.assign(Object.assign({}, context.repo), { ref,
|
||||||
|
sha }));
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.createRef = createRef;
|
||||||
function createTree(json) {
|
function createTree(json) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log(`creating tree at jessiscript/re_build_tracking`);
|
console.log(`creating tree at jessiscript/re_build_tracking`);
|
||||||
|
22
dist/main/index.js
generated
vendored
22
dist/main/index.js
generated
vendored
@ -74550,8 +74550,9 @@ function generateReports() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
||||||
(0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
|
yield (0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
|
||||||
(0, utils_1.createTree)(JSON.stringify(buildOutput));
|
const treeSha = yield (0, utils_1.createTree)(JSON.stringify(buildOutput));
|
||||||
|
yield (0, utils_1.createRef)(treeSha);
|
||||||
const report = createReport(buildOutput);
|
const report = createReport(buildOutput);
|
||||||
if (areJobReportsEnabled()) {
|
if (areJobReportsEnabled()) {
|
||||||
core.summary.addRaw(report);
|
core.summary.addRaw(report);
|
||||||
@ -75755,7 +75756,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.createTree = exports.saveReportJson = exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getLatestRelease = exports.exec = void 0;
|
exports.createTree = exports.createRef = exports.saveReportJson = exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getLatestRelease = exports.exec = void 0;
|
||||||
const c = __importStar(__nccwpck_require__(2764));
|
const c = __importStar(__nccwpck_require__(2764));
|
||||||
const core = __importStar(__nccwpck_require__(2258));
|
const core = __importStar(__nccwpck_require__(2258));
|
||||||
const github = __importStar(__nccwpck_require__(7168));
|
const github = __importStar(__nccwpck_require__(7168));
|
||||||
@ -75896,6 +75897,9 @@ exports.isPREvent = isPREvent;
|
|||||||
function getGitHubToken() {
|
function getGitHubToken() {
|
||||||
return core.getInput(c.INPUT_GITHUB_TOKEN);
|
return core.getInput(c.INPUT_GITHUB_TOKEN);
|
||||||
}
|
}
|
||||||
|
function getCommitSha() {
|
||||||
|
return process.env.GITHUB_SHA || "default_tag";
|
||||||
|
}
|
||||||
function createPRComment(content) {
|
function createPRComment(content) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@ -75945,6 +75949,18 @@ function saveReportJson(content) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.saveReportJson = saveReportJson;
|
exports.saveReportJson = saveReportJson;
|
||||||
|
function createRef(sha) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const ref = `refs/metrics/` + getCommitSha();
|
||||||
|
console.log(`creating ref ${ref} for metrics tree ${sha}`);
|
||||||
|
const octokit = github.getOctokit(getGitHubToken());
|
||||||
|
const context = github.context;
|
||||||
|
const response = yield octokit.request(`POST /repos/${context.repo.owner}/${context.repo.repo}/git/refs`, Object.assign(Object.assign({}, context.repo), { ref,
|
||||||
|
sha }));
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.createRef = createRef;
|
||||||
function createTree(json) {
|
function createTree(json) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log(`creating tree at jessiscript/re_build_tracking`);
|
console.log(`creating tree at jessiscript/re_build_tracking`);
|
||||||
|
@ -4,7 +4,7 @@ import * as fs from 'fs'
|
|||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import {tmpdir} from 'os'
|
import {tmpdir} from 'os'
|
||||||
import {createPRComment, createTree, isPREvent, saveReportJson, toSemVer} from '../utils'
|
import {createPRComment, createRef, createTree, isPREvent, saveReportJson, toSemVer} from '../utils'
|
||||||
import {gte} from 'semver'
|
import {gte} from 'semver'
|
||||||
import {Base64} from 'js-base64';
|
import {Base64} from 'js-base64';
|
||||||
import { Octokit } from '@octokit/rest';
|
import { Octokit } from '@octokit/rest';
|
||||||
@ -134,8 +134,9 @@ export async function generateReports(): Promise<void> {
|
|||||||
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
|
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
|
||||||
)
|
)
|
||||||
|
|
||||||
saveReportJson(JSON.stringify(buildOutput))
|
await saveReportJson(JSON.stringify(buildOutput))
|
||||||
createTree(JSON.stringify(buildOutput))
|
const treeSha = await createTree(JSON.stringify(buildOutput))
|
||||||
|
await createRef(treeSha)
|
||||||
|
|
||||||
const report = createReport(buildOutput)
|
const report = createReport(buildOutput)
|
||||||
if (areJobReportsEnabled()) {
|
if (areJobReportsEnabled()) {
|
||||||
|
22
src/utils.ts
22
src/utils.ts
@ -159,6 +159,10 @@ function getGitHubToken(): string {
|
|||||||
return core.getInput(c.INPUT_GITHUB_TOKEN)
|
return core.getInput(c.INPUT_GITHUB_TOKEN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCommitSha(): string {
|
||||||
|
return process.env.GITHUB_SHA || "default_tag"
|
||||||
|
}
|
||||||
|
|
||||||
export async function createPRComment(content: string): Promise<void> {
|
export async function createPRComment(content: string): Promise<void> {
|
||||||
if (!isPREvent()) {
|
if (!isPREvent()) {
|
||||||
throw new Error('Not a PR event.')
|
throw new Error('Not a PR event.')
|
||||||
@ -213,6 +217,24 @@ export async function saveReportJson(content: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function createRef(sha: string) {
|
||||||
|
const ref = `refs/metrics/` + getCommitSha()
|
||||||
|
console.log(`creating ref ${ref} for metrics tree ${sha}`);
|
||||||
|
const octokit = github.getOctokit(getGitHubToken());
|
||||||
|
|
||||||
|
const context = github.context
|
||||||
|
const response = await octokit.request(
|
||||||
|
`POST /repos/${context.repo.owner}/${context.repo.repo}/git/refs`,
|
||||||
|
{
|
||||||
|
...context.repo,
|
||||||
|
ref,
|
||||||
|
sha,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
|
||||||
export async function createTree(json: string): Promise<string> {
|
export async function createTree(json: string): Promise<string> {
|
||||||
console.log(`creating tree at jessiscript/re_build_tracking`);
|
console.log(`creating tree at jessiscript/re_build_tracking`);
|
||||||
const octokit = github.getOctokit(getGitHubToken());
|
const octokit = github.getOctokit(getGitHubToken());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user