Update github check with aws log
parent
2acd2c5ca9
commit
203d8eb538
|
|
@ -6110,6 +6110,43 @@ const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
|||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class GitHub {
|
||||
static createGitHubCheck(summary) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
return ``;
|
||||
}
|
||||
const sha = cloud_runner_1.default.buildParameters.gitSha;
|
||||
const name = `Cloud Runner (${cloud_runner_1.default.buildParameters.buildGuid})`;
|
||||
const nameReadable = name;
|
||||
const token = cloud_runner_1.default.buildParameters.gitPrivateToken;
|
||||
const owner = cloud_runner_options_1.default.githubOwner;
|
||||
const repo = cloud_runner_options_1.default.githubRepoName;
|
||||
GitHub.startedDate = Date.now();
|
||||
// call github api to create a check
|
||||
const octokit = new core_1.Octokit({
|
||||
auth: process.env.CHECKS_API_TOKEN || token,
|
||||
});
|
||||
cloud_runner_logger_1.default.log(`POST /repos/${owner}/${repo}/check-runs`);
|
||||
const result = yield octokit.request(`POST /repos/${owner}/${repo}/check-runs`, {
|
||||
owner,
|
||||
repo,
|
||||
name,
|
||||
// eslint-disable-next-line camelcase
|
||||
head_sha: sha,
|
||||
status: 'in_progress',
|
||||
// eslint-disable-next-line camelcase
|
||||
external_id: cloud_runner_1.default.buildParameters.buildGuid,
|
||||
// eslint-disable-next-line camelcase
|
||||
started_at: GitHub.startedDate,
|
||||
output: {
|
||||
title: nameReadable,
|
||||
summary,
|
||||
text: '',
|
||||
},
|
||||
});
|
||||
return result.data.id;
|
||||
});
|
||||
}
|
||||
static updateGitHubCheck(summary, longDescription, result = `in_progress`, status = `completed`) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
|
|
@ -6157,46 +6194,9 @@ class GitHub {
|
|||
yield octokit.request(`PATCH /repos/${owner}/${repo}/check-runs/${checkRunId}`, data);
|
||||
});
|
||||
}
|
||||
static createGitHubCheck(summary) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
return;
|
||||
}
|
||||
const sha = cloud_runner_1.default.buildParameters.gitSha;
|
||||
const name = `Cloud Runner (${cloud_runner_1.default.buildParameters.buildGuid})`;
|
||||
const nameReadable = name;
|
||||
const token = cloud_runner_1.default.buildParameters.gitPrivateToken;
|
||||
const owner = cloud_runner_options_1.default.githubOwner;
|
||||
const repo = cloud_runner_options_1.default.githubRepoName;
|
||||
// call github api to create a check
|
||||
const octokit = new core_1.Octokit({
|
||||
auth: process.env.CHECKS_API_TOKEN || token,
|
||||
});
|
||||
cloud_runner_logger_1.default.log(`POST /repos/${owner}/${repo}/check-runs`);
|
||||
const result = yield octokit.request(`POST /repos/${owner}/${repo}/check-runs`, {
|
||||
owner,
|
||||
repo,
|
||||
name,
|
||||
// eslint-disable-next-line camelcase
|
||||
head_sha: sha,
|
||||
status: 'in_progress',
|
||||
// eslint-disable-next-line camelcase
|
||||
external_id: '42',
|
||||
// eslint-disable-next-line camelcase
|
||||
started_at: GitHub.startedDate,
|
||||
output: {
|
||||
title: nameReadable,
|
||||
summary,
|
||||
text: '',
|
||||
},
|
||||
});
|
||||
return result.data.id;
|
||||
});
|
||||
}
|
||||
}
|
||||
GitHub.githubInputEnabled = true;
|
||||
GitHub.longDescriptionContent = ``;
|
||||
GitHub.startedDate = Date.now();
|
||||
exports["default"] = GitHub;
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -23,7 +23,7 @@ class CloudRunner {
|
|||
private static cloudRunnerEnvironmentVariables: CloudRunnerEnvironmentVariable[];
|
||||
static lockedWorkspace: string | undefined;
|
||||
public static readonly retainedWorkspacePrefix: string = `retained-workspace`;
|
||||
static githubCheckId;
|
||||
public static githubCheckId;
|
||||
public static setup(buildParameters: BuildParameters) {
|
||||
CloudRunnerLogger.setup();
|
||||
CloudRunnerLogger.log(`Setting up cloud runner`);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,47 @@ import CloudRunnerOptions from './cloud-runner/cloud-runner-options';
|
|||
class GitHub {
|
||||
public static githubInputEnabled: boolean = true;
|
||||
private static longDescriptionContent = ``;
|
||||
static startedDate = Date.now();
|
||||
private static startedDate;
|
||||
|
||||
public static async createGitHubCheck(summary) {
|
||||
if (!CloudRunnerOptions.githubChecksEnabled) {
|
||||
return ``;
|
||||
}
|
||||
const sha = CloudRunner.buildParameters.gitSha;
|
||||
const name = `Cloud Runner (${CloudRunner.buildParameters.buildGuid})`;
|
||||
const nameReadable = name;
|
||||
const token = CloudRunner.buildParameters.gitPrivateToken;
|
||||
const owner = CloudRunnerOptions.githubOwner;
|
||||
const repo = CloudRunnerOptions.githubRepoName;
|
||||
GitHub.startedDate = Date.now();
|
||||
|
||||
// call github api to create a check
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.CHECKS_API_TOKEN || token,
|
||||
});
|
||||
|
||||
CloudRunnerLogger.log(`POST /repos/${owner}/${repo}/check-runs`);
|
||||
|
||||
const result = await octokit.request(`POST /repos/${owner}/${repo}/check-runs`, {
|
||||
owner,
|
||||
repo,
|
||||
name,
|
||||
// eslint-disable-next-line camelcase
|
||||
head_sha: sha,
|
||||
status: 'in_progress',
|
||||
// eslint-disable-next-line camelcase
|
||||
external_id: CloudRunner.buildParameters.buildGuid,
|
||||
// eslint-disable-next-line camelcase
|
||||
started_at: GitHub.startedDate,
|
||||
output: {
|
||||
title: nameReadable,
|
||||
summary,
|
||||
text: '',
|
||||
},
|
||||
});
|
||||
|
||||
return result.data.id;
|
||||
}
|
||||
|
||||
public static async updateGitHubCheck(summary, longDescription, result = `in_progress`, status = `completed`) {
|
||||
if (!CloudRunnerOptions.githubChecksEnabled) {
|
||||
|
|
@ -55,45 +95,6 @@ class GitHub {
|
|||
|
||||
await octokit.request(`PATCH /repos/${owner}/${repo}/check-runs/${checkRunId}`, data);
|
||||
}
|
||||
|
||||
public static async createGitHubCheck(summary) {
|
||||
if (!CloudRunnerOptions.githubChecksEnabled) {
|
||||
return;
|
||||
}
|
||||
const sha = CloudRunner.buildParameters.gitSha;
|
||||
const name = `Cloud Runner (${CloudRunner.buildParameters.buildGuid})`;
|
||||
const nameReadable = name;
|
||||
const token = CloudRunner.buildParameters.gitPrivateToken;
|
||||
const owner = CloudRunnerOptions.githubOwner;
|
||||
const repo = CloudRunnerOptions.githubRepoName;
|
||||
|
||||
// call github api to create a check
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.CHECKS_API_TOKEN || token,
|
||||
});
|
||||
|
||||
CloudRunnerLogger.log(`POST /repos/${owner}/${repo}/check-runs`);
|
||||
|
||||
const result = await octokit.request(`POST /repos/${owner}/${repo}/check-runs`, {
|
||||
owner,
|
||||
repo,
|
||||
name,
|
||||
// eslint-disable-next-line camelcase
|
||||
head_sha: sha,
|
||||
status: 'in_progress',
|
||||
// eslint-disable-next-line camelcase
|
||||
external_id: '42',
|
||||
// eslint-disable-next-line camelcase
|
||||
started_at: GitHub.startedDate,
|
||||
output: {
|
||||
title: nameReadable,
|
||||
summary,
|
||||
text: '',
|
||||
},
|
||||
});
|
||||
|
||||
return result.data.id;
|
||||
}
|
||||
}
|
||||
|
||||
export default GitHub;
|
||||
|
|
|
|||
Loading…
Reference in New Issue