parameterize s3
parent
5d512a0a59
commit
57de40672d
|
|
@ -6389,11 +6389,16 @@ const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
|||
const core = __importStar(__nccwpck_require__(42186));
|
||||
const core_1 = __nccwpck_require__(76762);
|
||||
class GitHub {
|
||||
static get octokit() {
|
||||
static get octokitDefaultToken() {
|
||||
return new core_1.Octokit({
|
||||
auth: process.env.GITHUB_TOKEN,
|
||||
});
|
||||
}
|
||||
static get octokitPAT() {
|
||||
return new core_1.Octokit({
|
||||
auth: cloud_runner_1.default.buildParameters.gitPrivateToken,
|
||||
});
|
||||
}
|
||||
static get sha() {
|
||||
return cloud_runner_1.default.buildParameters.gitSha;
|
||||
}
|
||||
|
|
@ -6488,12 +6493,12 @@ class GitHub {
|
|||
}
|
||||
static updateGitHubCheckRequest(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield GitHub.octokit.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
return yield GitHub.octokitDefaultToken.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
});
|
||||
}
|
||||
static createGitHubCheckRequest(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield GitHub.octokit.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
return yield GitHub.octokitDefaultToken.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
});
|
||||
}
|
||||
static runUpdateAsyncChecksWorkflow(data, mode) {
|
||||
|
|
@ -6501,7 +6506,7 @@ class GitHub {
|
|||
if (mode === `create`) {
|
||||
throw new Error(`Not supported: only use update`);
|
||||
}
|
||||
const workflowsResult = yield GitHub.octokit.request(`GET /repos/${GitHub.owner}/${GitHub.repo}/actions/workflows`, {
|
||||
const workflowsResult = yield GitHub.octokitDefaultToken.request(`GET /repos/${GitHub.owner}/${GitHub.repo}/actions/workflows`, {
|
||||
owner: GitHub.owner,
|
||||
repo: GitHub.repo,
|
||||
});
|
||||
|
|
@ -6516,7 +6521,7 @@ class GitHub {
|
|||
core.info(JSON.stringify(workflows));
|
||||
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
||||
}
|
||||
yield GitHub.octokit.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches`, {
|
||||
yield GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches`, {
|
||||
owner: GitHub.owner,
|
||||
repo: GitHub.repo,
|
||||
// eslint-disable-next-line camelcase
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,11 +9,16 @@ class GitHub {
|
|||
private static longDescriptionContent: string = ``;
|
||||
private static startedDate: string;
|
||||
private static endedDate: string;
|
||||
private static get octokit() {
|
||||
private static get octokitDefaultToken() {
|
||||
return new Octokit({
|
||||
auth: process.env.GITHUB_TOKEN,
|
||||
});
|
||||
}
|
||||
private static get octokitPAT() {
|
||||
return new Octokit({
|
||||
auth: CloudRunner.buildParameters.gitPrivateToken,
|
||||
});
|
||||
}
|
||||
private static get sha() {
|
||||
return CloudRunner.buildParameters.gitSha;
|
||||
}
|
||||
|
|
@ -118,18 +123,18 @@ class GitHub {
|
|||
}
|
||||
|
||||
public static async updateGitHubCheckRequest(data) {
|
||||
return await GitHub.octokit.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
return await GitHub.octokitDefaultToken.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
}
|
||||
|
||||
public static async createGitHubCheckRequest(data) {
|
||||
return await GitHub.octokit.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
return await GitHub.octokitDefaultToken.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
}
|
||||
|
||||
public static async runUpdateAsyncChecksWorkflow(data, mode) {
|
||||
if (mode === `create`) {
|
||||
throw new Error(`Not supported: only use update`);
|
||||
}
|
||||
const workflowsResult = await GitHub.octokit.request(
|
||||
const workflowsResult = await GitHub.octokitDefaultToken.request(
|
||||
`GET /repos/${GitHub.owner}/${GitHub.repo}/actions/workflows`,
|
||||
{
|
||||
owner: GitHub.owner,
|
||||
|
|
@ -147,7 +152,7 @@ class GitHub {
|
|||
core.info(JSON.stringify(workflows));
|
||||
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
||||
}
|
||||
await GitHub.octokit.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches`, {
|
||||
await GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches`, {
|
||||
owner: GitHub.owner,
|
||||
repo: GitHub.repo,
|
||||
// eslint-disable-next-line camelcase
|
||||
|
|
|
|||
Loading…
Reference in New Issue