From 94f905609de7354969c6a7c0e3c68518aa1cf415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Bokvad=20Engar=C3=A5s?= Date: Thu, 28 Sep 2023 15:24:56 +0200 Subject: [PATCH] refactor project --- .../BranchProtectionService.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/branchprotection/BranchProtectionService.ts b/src/branchprotection/BranchProtectionService.ts index b7bdffaf..0bf9bb12 100644 --- a/src/branchprotection/BranchProtectionService.ts +++ b/src/branchprotection/BranchProtectionService.ts @@ -6,31 +6,31 @@ export class BranchProtectionService { public static async getStateOfBranchProtection(): Promise { console.log('\n Running branch protection control'); - const octokit: Octokit = new Octokit(); + // const octokit: Octokit = new Octokit(); const { owner, repo }: { owner: string; repo: string } = github.context.repo; - octokit.repos - .getBranchProtection({ - owner: owner, - repo: repo, - branch: 'main', - }) - .then((response: any) => { - console.log( - 'Branch protection is enabled, and reviewers needed are:', - response.data.required_approving_review_count - ); - console.log(response.data); - }) - .catch((error: any) => { - console.log('Branch protections is not enabled for repository: ' + repo); - console.log('Error:', error?.message); - }); + // octokit.repos + // .getBranchProtection({ + // owner: owner, + // repo: repo, + // branch: 'main', + // }) + // .then((response: any) => { + // console.log( + // 'Branch protection is enabled, and reviewers needed are:', + // response.data.required_approving_review_count + // ); + // console.log(response.data); + // }) + // .catch((error: any) => { + // console.log('Branch protections is not enabled for repository: ' + repo); + // console.log('Error:', error?.message); + // }); //numberOfReviewers > 0, if state of branch protection changes const numberOfReviewers: number = 0; - // const token: string = core.getInput('github-token'); - // const octokit: any = github.getOctokit(token); + const token: string = core.getInput('github-token'); + const octokit: any = github.getOctokit(token); await octokit.rest.repos .getBranchProtection({