Skip to content

Commit

Permalink
Merge pull request #9 from Omegapoint/feature/NewTesterTest3
Browse files Browse the repository at this point in the history
refactor project
  • Loading branch information
jonathanbokvad authored Sep 28, 2023
2 parents cbcf180 + 94f9056 commit 6165cc9
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/branchprotection/BranchProtectionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ export class BranchProtectionService {
public static async getStateOfBranchProtection(): Promise<void> {
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({
Expand Down

0 comments on commit 6165cc9

Please sign in to comment.