Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor project #21

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 3 additions & 203 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@octokit/action": "^6.0.6",
"@vercel/ncc": "^0.36.1",
"joi": "^17.10.1"
},
Expand Down
24 changes: 1 addition & 23 deletions src/branchprotection/BranchProtectionService.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as core from '@actions/core';
import * as github from '@actions/github';
import { Octokit } from '@octokit/action';
export class BranchProtectionService {
public static async getStateOfBranchProtection(): Promise<void> {
console.log('\n Running branch protection control');

// 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);
// });

//numberOfReviewers > 0, if state of branch protection changes
const numberOfReviewers: number = 0;

const token: string = core.getInput('github-token');
const token: string = core.getInput('PAT-token');
const octokit: any = github.getOctokit(token);

await octokit.rest.repos
Expand Down
Loading