Skip to content

Commit

Permalink
Remove old code
Browse files Browse the repository at this point in the history
  • Loading branch information
hampus-andersson-op committed Mar 12, 2024
1 parent 8461eb6 commit 7f9f87f
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions src/scatools/DependabotService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export class DependabotService {

const { owner, repo }: { owner: string; repo: string } = github.context.repo;
const token: string = core.getInput('PAT-token');
// type dependabotAlertType = Endpoints['GET /repos/{owner}/{repo}/dependabot/alerts']['response'];
// const octokit: InstanceType<typeof GitHub> = github.getOctokit(token);
const octokit = new Octokit({
auth: token
});
Expand All @@ -19,7 +17,7 @@ export class DependabotService {
owner: owner,
repo: repo,
per_page: 100,
// state: "open"
state: "open"
}
)

Expand Down Expand Up @@ -47,33 +45,6 @@ export class DependabotService {
}
}

// const alerts: any = await octokit.paginate(
// "GET /repos/{owner}/{repo}/dependabot/alerts",
// {
// owner: owner,
// repo: repo,
// per_page: 100,
// });

// for (const alert of alerts){
// for(const a of alert.data) {
// }
// switch (alert){
// case "low":
// scaNumberOfSeverity1 ++
// break
// case "medium":
// scaNumberOfSeverity2 ++
// break
// case "high":
// scaNumberOfSeverity3 ++
// break
// case "critical":
// scaNumberOfSeverity4 ++
// break
// }
// }

console.log(scaNumberOfSeverity1);
console.log(scaNumberOfSeverity2);
console.log(scaNumberOfSeverity3);
Expand All @@ -85,41 +56,4 @@ export class DependabotService {
core.exportVariable('scaNumberOfSeverity3', scaNumberOfSeverity3);
core.exportVariable('scaNumberOfSeverity4', scaNumberOfSeverity4);
}

// public static async setDependabotFindings2(): Promise<void> {

// const { owner, repo }: { owner: string; repo: string } = github.context.repo;
// const token: string = core.getInput('PAT-token');

// const octokit: InstanceType<typeof GitHub> = github.getOctokit(token);
// type dependabotAlertType = Endpoints['GET /repos/{owner}/{repo}/dependabot/alerts']['response'];

// const alerts: Array<dependabotAlertType> = await octokit.paginate(
// "GET /repos/{owner}/{repo}/dependabot/alerts",
// {
// owner: owner,
// repo: repo,
// per_page: 100,
// });

// const severeties = alerts.flatMap((alert) => DependabotService.GetSeverity(alert));

// const lowSeverityCount = DependabotService.severityCountForGivenSeverity(severeties, "low");
// const mediumSeverityCount = DependabotService.severityCountForGivenSeverity(severeties, "medium");
// const highwSeverityCount = DependabotService.severityCountForGivenSeverity(severeties, "high");
// const criticalSeverityCount = DependabotService.severityCountForGivenSeverity(severeties, "critical");

// core.exportVariable('scaNumberOfSeverity1', lowSeverityCount);
// core.exportVariable('scaNumberOfSeverity2', mediumSeverityCount);
// core.exportVariable('scaNumberOfSeverity3', highwSeverityCount);
// core.exportVariable('scaNumberOfSeverity4', criticalSeverityCount);
// }

// private static severityCountForGivenSeverity(severeties: ("low" | "medium" | "high" | "critical")[], severity: string) {
// return severeties.filter((allert) => allert === severity).length;
// }

// private static GetSeverity(alert): "low" | "medium" | "high" | "critical" | readonly ("low" | "medium" | "high" | "critical")[] {
// return alert.data.flatMap((data) => data.security_vulnerability.severity);
// }
}

0 comments on commit 7f9f87f

Please sign in to comment.