test checks

pull/479/head
Frostebite 2022-12-05 23:56:13 +00:00
parent 3f2ccc00e8
commit cf3b8f127e
5 changed files with 20 additions and 9 deletions

14
dist/index.js vendored
View File

@ -722,7 +722,7 @@ class CloudRunnerOptions {
return CloudRunnerOptions.getInput('githubChecks') || false;
}
static get githubOwner() {
return CloudRunnerOptions.githubRepo.split(`/`)[1] || false;
return CloudRunnerOptions.githubRepo.split(`github.com/`)[1] || false;
}
// ### ### ###
// Git syncronization parameters
@ -1029,7 +1029,7 @@ class CloudRunner {
CloudRunner.setup(buildParameters);
try {
if (cloud_runner_options_1.default.githubChecksEnabled) {
github_1.default.createGitHubCheck(cloud_runner_options_1.default.githubOwner, buildParameters.githubRepo, buildParameters.gitPrivateToken, 'test-check-name', buildParameters.gitSha, 'A check test', buildParameters.buildGuid);
yield github_1.default.createGitHubCheck(cloud_runner_options_1.default.githubOwner, buildParameters.githubRepo, buildParameters.gitPrivateToken, 'test-check-name', buildParameters.gitSha, 'A check test', buildParameters.buildGuid);
}
if (buildParameters.retainWorkspace) {
CloudRunner.lockedWorkspace = `${CloudRunner.retainedWorkspacePrefix}-${CloudRunner.buildParameters.buildGuid}`;
@ -6067,19 +6067,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const core_1 = __nccwpck_require__(76762);
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
class GitHub {
static updateGitHubCheck(owner, repo, token, name, sha, nameReadable, summary, longDescription) {
return __awaiter(this, void 0, void 0, function* () {
const octokit = new core_1.Octokit({
auth: token,
});
const checkRunId = 0;
const data = {
owner,
repo,
// eslint-disable-next-line camelcase
check_run_id: 0,
check_run_id: checkRunId,
name,
// eslint-disable-next-line camelcase
head_sha: sha,
@ -6103,7 +6108,7 @@ class GitHub {
],
},
};
yield octokit.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', data);
yield octokit.request(`PATCH /repos/${owner}/${repo}/check-runs/${checkRunId}`, data);
});
}
static createGitHubCheck(owner, repo, token, name, sha, nameReadable, summary) {
@ -6112,6 +6117,7 @@ class GitHub {
const octokit = new core_1.Octokit({
auth: token,
});
cloud_runner_logger_1.default.log(`POST /repos/${owner}/${repo}/check-runs`);
yield octokit.request(`POST /repos/${owner}/${repo}/check-runs`, {
owner,
repo,

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,7 @@ class CloudRunnerOptions {
}
static get githubOwner() {
return CloudRunnerOptions.githubRepo.split(`/`)[1] || false;
return CloudRunnerOptions.githubRepo.split(`github.com/`)[1] || false;
}
// ### ### ###

View File

@ -70,7 +70,7 @@ class CloudRunner {
CloudRunner.setup(buildParameters);
try {
if (CloudRunnerOptions.githubChecksEnabled) {
GitHub.createGitHubCheck(
await GitHub.createGitHubCheck(
CloudRunnerOptions.githubOwner,
buildParameters.githubRepo,
buildParameters.gitPrivateToken,

View File

@ -1,4 +1,5 @@
import { Octokit } from '@octokit/core';
import CloudRunnerLogger from './cloud-runner/services/cloud-runner-logger';
class GitHub {
public static githubInputEnabled: boolean = true;
@ -8,11 +9,13 @@ class GitHub {
auth: token,
});
const checkRunId = 0;
const data: any = {
owner,
repo,
// eslint-disable-next-line camelcase
check_run_id: 0,
check_run_id: checkRunId,
name,
// eslint-disable-next-line camelcase
head_sha: sha,
@ -37,7 +40,7 @@ class GitHub {
},
};
await octokit.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', data);
await octokit.request(`PATCH /repos/${owner}/${repo}/check-runs/${checkRunId}`, data);
}
public static async createGitHubCheck(owner, repo, token, name, sha, nameReadable, summary) {
@ -46,6 +49,8 @@ class GitHub {
auth: token,
});
CloudRunnerLogger.log(`POST /repos/${owner}/${repo}/check-runs`);
await octokit.request(`POST /repos/${owner}/${repo}/check-runs`, {
owner,
repo,