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 = __importStar(__nccwpck_require__(42186));
|
||||||
const core_1 = __nccwpck_require__(76762);
|
const core_1 = __nccwpck_require__(76762);
|
||||||
class GitHub {
|
class GitHub {
|
||||||
static get octokit() {
|
static get octokitDefaultToken() {
|
||||||
return new core_1.Octokit({
|
return new core_1.Octokit({
|
||||||
auth: process.env.GITHUB_TOKEN,
|
auth: process.env.GITHUB_TOKEN,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
static get octokitPAT() {
|
||||||
|
return new core_1.Octokit({
|
||||||
|
auth: cloud_runner_1.default.buildParameters.gitPrivateToken,
|
||||||
|
});
|
||||||
|
}
|
||||||
static get sha() {
|
static get sha() {
|
||||||
return cloud_runner_1.default.buildParameters.gitSha;
|
return cloud_runner_1.default.buildParameters.gitSha;
|
||||||
}
|
}
|
||||||
|
|
@ -6488,12 +6493,12 @@ class GitHub {
|
||||||
}
|
}
|
||||||
static updateGitHubCheckRequest(data) {
|
static updateGitHubCheckRequest(data) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
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) {
|
static createGitHubCheckRequest(data) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
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) {
|
static runUpdateAsyncChecksWorkflow(data, mode) {
|
||||||
|
|
@ -6501,7 +6506,7 @@ class GitHub {
|
||||||
if (mode === `create`) {
|
if (mode === `create`) {
|
||||||
throw new Error(`Not supported: only use update`);
|
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,
|
owner: GitHub.owner,
|
||||||
repo: GitHub.repo,
|
repo: GitHub.repo,
|
||||||
});
|
});
|
||||||
|
|
@ -6516,7 +6521,7 @@ class GitHub {
|
||||||
core.info(JSON.stringify(workflows));
|
core.info(JSON.stringify(workflows));
|
||||||
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
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,
|
owner: GitHub.owner,
|
||||||
repo: GitHub.repo,
|
repo: GitHub.repo,
|
||||||
// eslint-disable-next-line camelcase
|
// 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 longDescriptionContent: string = ``;
|
||||||
private static startedDate: string;
|
private static startedDate: string;
|
||||||
private static endedDate: string;
|
private static endedDate: string;
|
||||||
private static get octokit() {
|
private static get octokitDefaultToken() {
|
||||||
return new Octokit({
|
return new Octokit({
|
||||||
auth: process.env.GITHUB_TOKEN,
|
auth: process.env.GITHUB_TOKEN,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private static get octokitPAT() {
|
||||||
|
return new Octokit({
|
||||||
|
auth: CloudRunner.buildParameters.gitPrivateToken,
|
||||||
|
});
|
||||||
|
}
|
||||||
private static get sha() {
|
private static get sha() {
|
||||||
return CloudRunner.buildParameters.gitSha;
|
return CloudRunner.buildParameters.gitSha;
|
||||||
}
|
}
|
||||||
|
|
@ -118,18 +123,18 @@ class GitHub {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async updateGitHubCheckRequest(data) {
|
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) {
|
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) {
|
public static async runUpdateAsyncChecksWorkflow(data, mode) {
|
||||||
if (mode === `create`) {
|
if (mode === `create`) {
|
||||||
throw new Error(`Not supported: only use update`);
|
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`,
|
`GET /repos/${GitHub.owner}/${GitHub.repo}/actions/workflows`,
|
||||||
{
|
{
|
||||||
owner: GitHub.owner,
|
owner: GitHub.owner,
|
||||||
|
|
@ -147,7 +152,7 @@ class GitHub {
|
||||||
core.info(JSON.stringify(workflows));
|
core.info(JSON.stringify(workflows));
|
||||||
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
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,
|
owner: GitHub.owner,
|
||||||
repo: GitHub.repo,
|
repo: GitHub.repo,
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue