Skip to content

Commit

Permalink
refactor project
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanbokvad committed Oct 5, 2023
1 parent 10f9d06 commit f30fe5a
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 100 deletions.
196 changes: 98 additions & 98 deletions src/Pentest/PentestService.ts
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
import * as core from '@actions/core';

export class PentestService {
public static async getStateOfPentest(pentest: { date: string; boardsTag?: string }): Promise<void> {
public static async getStateOfPentest(pentest: { date: string }): Promise<void> {
if (process.env.pentestDate) {
core.exportVariable('pentestDate', process.env.pentestDate);
core.exportVariable('pentestDate', process.env.pentestDate);
} else {
if (!pentest.date || pentest.date === 'date-of-pentest') {
core.warning('Pentest Date is not set!');
return;
}
core.exportVariable('pentestDate', pentest.date);
core.exportVariable('pentestDate', pentest.date);
}
}
}
//console.log('Pentest Date is set', pentestDate.date);
//console.log('Pentest Date is set', pentestDate.date);

// const token = core.getInput('repo-token');
// console.log('Got the token');
// const token = core.getInput('repo-token');
// console.log('Got the token');

// const octokit = github.getOctokit(token);
// console.log('octoKit authenticated');
// const octokit = github.getOctokit(token);
// console.log('octoKit authenticated');

// const { owner, repo } = github.context.repo;
// console.log(`Owner: ${owner}`);
// console.log(`Repo: ${repo}`);
// const { owner, repo } = github.context.repo;
// console.log(`Owner: ${owner}`);
// console.log(`Repo: ${repo}`);

// console.log('Going to get Pentest tickets from github boards');
// console.log('Going to get Pentest tickets from github boards');

// await octokit.rest.projects
// .createForRepo({
// owner: owner,
// repo: repo,
// name: 'Projects Jonathan B',
// })
// .then(async (response) => {
// console.log('Got the column for repo');
// console.log(response.data);
// })
// .catch((error) => {
// core.warning('Error getting column!');
// console.log('Error: ', error);
// });
// await octokit.rest.projects
// .listForOrg({
// org: owner,
// })
// .then(async (response) => {
// console.log('Got the projects for org');
// console.log(response.data);
// })
// .catch((error) => {
// core.warning('Error getting projects for org!');
// console.log('Error: ', error);
// });
// await octokit.rest.projects
// .createForRepo({
// owner: owner,
// repo: repo,
// name: 'Projects Jonathan B',
// })
// .then(async (response) => {
// console.log('Got the column for repo');
// console.log(response.data);
// })
// .catch((error) => {
// core.warning('Error getting column!');
// console.log('Error: ', error);
// });
// await octokit.rest.projects
// .listForOrg({
// org: owner,
// })
// .then(async (response) => {
// console.log('Got the projects for org');
// console.log(response.data);
// })
// .catch((error) => {
// core.warning('Error getting projects for org!');
// console.log('Error: ', error);
// });

// const customLabelIssues = await octokit.rest.issues
// .listForRepo({
// owner: owner,
// repo: repo,
// })
// .then(async (response) => {
// const issues = response.data;
// console.log('Got the issues');
// console.log('Number of issues: ', issues.length);
// const customLabelIssues = issues.filter((issue) => {
// console.log('issue', issue.title);
// return issue.labels.some((label: any) => label.name === pentestDate.boardsTag);
// });
// console.log('customLabelIssues', customLabelIssues.length);
// return customLabelIssues;
// })
// .catch((error) => {
// core.warning('Error getting project for repo!');
// console.log('Error: ', error);
// });
// const customLabelIssues = await octokit.rest.issues
// .listForRepo({
// owner: owner,
// repo: repo,
// })
// .then(async (response) => {
// const issues = response.data;
// console.log('Got the issues');
// console.log('Number of issues: ', issues.length);
// const customLabelIssues = issues.filter((issue) => {
// console.log('issue', issue.title);
// return issue.labels.some((label: any) => label.name === pentestDate.boardsTag);
// });
// console.log('customLabelIssues', customLabelIssues.length);
// return customLabelIssues;
// })
// .catch((error) => {
// core.warning('Error getting project for repo!');
// console.log('Error: ', error);
// });

// await octokit.rest.projects
// .listCards({
// owner: owner,
// repo: repo,
// column_id: 24,
// })
// .then(async (response) => {
// console.log('Got the cards');
// const projectCards = response.data;
// // const customLabelCards = projectCards.filter((card) => {
// // return card.note?.includes(pentestDate.boardsTag);
// // });
// await octokit.rest.projects
// .listCards({
// owner: owner,
// repo: repo,
// column_id: 24,
// })
// .then(async (response) => {
// console.log('Got the cards');
// const projectCards = response.data;
// // const customLabelCards = projectCards.filter((card) => {
// // return card.note?.includes(pentestDate.boardsTag);
// // });

// const customLabelCards = [];
// console.log('projectCards', projectCards);
// for (const card of projectCards) {
// // Get the associated issue or pull request for the card
// console.log('card', card);
// const contentResponse = await octokit.request(card.content_url);
// console.log('contentResponse', contentResponse);
// if (contentResponse.data.labels.some((label: any) => label.name === pentestDate.boardsTag)) {
// customLabelCards.push(card);
// }
// }
// const customLabelCards = [];
// console.log('projectCards', projectCards);
// for (const card of projectCards) {
// // Get the associated issue or pull request for the card
// console.log('card', card);
// const contentResponse = await octokit.request(card.content_url);
// console.log('contentResponse', contentResponse);
// if (contentResponse.data.labels.some((label: any) => label.name === pentestDate.boardsTag)) {
// customLabelCards.push(card);
// }
// }

// console.log('customLabelCards', customLabelCards);
// return customLabelCards;
// })
// .catch((error) => {
// core.warning('Error getting cards!');
// console.log('Error: ', error);
// });
// console.log('customLabelCards', customLabelCards);
// return customLabelCards;
// })
// .catch((error) => {
// core.warning('Error getting cards!');
// console.log('Error: ', error);
// });

// owner: owner,
// repo: repo,
// branch: 'main',
// }).then((response) => {
// console.log("Got the branch protection");
// console.log(response.data);
// }).catch((error) => {
// core.warning("Error getting branch protection!");
// core.warning("Error: ", error.message);
// });
// owner: owner,
// repo: repo,
// branch: 'main',
// }).then((response) => {
// console.log("Got the branch protection");
// console.log(response.data);
// }).catch((error) => {
// core.warning("Error getting branch protection!");
// core.warning("Error: ", error.message);
// });
4 changes: 2 additions & 2 deletions src/threatmodeling/ThreatModelingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import * as core from '@actions/core';
export class ThreatModelingService {
public static async getStateOfThreatModeling(threatModeling: { date: string; boardsTag?: string }): Promise<void> {
if (process.env.threatModelingDate) {
core.exportVariable('threatModelingDate', process.env.threatModelingDate);
core.exportVariable('threatModelingDate', process.env.threatModelingDate);
} else {
if (!threatModeling.date || threatModeling.date === 'date-of-threat-modeling') {
core.warning('Threat Modeling Date is not set!');
return;
}
core.exportVariable('threatModelingDate', threatModeling.date);
core.exportVariable('threatModelingDate', threatModeling.date);
}
}
}

0 comments on commit f30fe5a

Please sign in to comment.