mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-07-02 07:33:14 +08:00
undone changes
This commit is contained in:
parent
5bc77ce65e
commit
a342fbb5bc
39
dist/main/index.js
generated
vendored
39
dist/main/index.js
generated
vendored
@ -74551,8 +74551,6 @@ function generateReports() {
|
|||||||
}
|
}
|
||||||
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
||||||
yield (0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
|
yield (0, utils_1.saveReportJson)(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);
|
||||||
@ -75756,7 +75754,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.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;
|
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));
|
||||||
@ -75897,9 +75895,6 @@ 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* () {
|
||||||
@ -75908,7 +75903,7 @@ function createPRComment(content) {
|
|||||||
}
|
}
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
try {
|
try {
|
||||||
yield new rest_1.Octokit({ auth: process.env.GITHUB_TOKEN }).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content }));
|
yield github.getOctokit(getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content }));
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.error(`Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}`);
|
core.error(`Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}`);
|
||||||
@ -75949,36 +75944,6 @@ 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 = new rest_1.Octokit({ auth: process.env.GITHUB_TOKEN });
|
|
||||||
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) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
console.log(`creating tree at jessiscript/re_build_tracking`);
|
|
||||||
const octokit = new rest_1.Octokit({ auth: process.env.GITHUB_TOKEN });
|
|
||||||
const context = github.context;
|
|
||||||
const response = yield octokit.request(`POST /repos/${context.repo.owner}/${context.repo.repo}/git/trees`, Object.assign(Object.assign({}, context.repo), { tree: [
|
|
||||||
{
|
|
||||||
path: "report.json",
|
|
||||||
mode: "100644",
|
|
||||||
type: "blob",
|
|
||||||
content: json,
|
|
||||||
},
|
|
||||||
] }));
|
|
||||||
console.log(response);
|
|
||||||
return response.data.sha;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.createTree = createTree;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -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, createRef, createTree, isPREvent, saveReportJson, toSemVer} from '../utils'
|
import {createPRComment, 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';
|
||||||
@ -135,8 +135,6 @@ export async function generateReports(): Promise<void> {
|
|||||||
)
|
)
|
||||||
|
|
||||||
await saveReportJson(JSON.stringify(buildOutput))
|
await saveReportJson(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()) {
|
||||||
|
50
src/utils.ts
50
src/utils.ts
@ -159,17 +159,13 @@ 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.')
|
||||||
}
|
}
|
||||||
const context = github.context
|
const context = github.context
|
||||||
try {
|
try {
|
||||||
await new Octokit({ auth: process.env.GITHUB_TOKEN }).rest.issues.createComment({
|
await github.getOctokit(getGitHubToken()).rest.issues.createComment({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
issue_number: context.payload.pull_request?.number as number,
|
issue_number: context.payload.pull_request?.number as number,
|
||||||
body: content
|
body: content
|
||||||
@ -180,8 +176,8 @@ export async function createPRComment(content: string): Promise<void> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function saveReportJson(content: string): Promise<void> {
|
|
||||||
|
|
||||||
|
export async function saveReportJson(content: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: getGitHubToken(),
|
auth: getGitHubToken(),
|
||||||
@ -216,45 +212,3 @@ 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 = new Octokit({ auth: process.env.GITHUB_TOKEN });
|
|
||||||
|
|
||||||
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> {
|
|
||||||
console.log(`creating tree at jessiscript/re_build_tracking`);
|
|
||||||
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
|
|
||||||
|
|
||||||
const context = github.context
|
|
||||||
const response = await octokit.request(
|
|
||||||
`POST /repos/${context.repo.owner}/${context.repo.repo}/git/trees`,
|
|
||||||
{
|
|
||||||
...context.repo,
|
|
||||||
tree: [
|
|
||||||
{
|
|
||||||
path: "report.json",
|
|
||||||
mode: "100644",
|
|
||||||
type: "blob",
|
|
||||||
content: json,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(response);
|
|
||||||
return response.data.sha;
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user