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({