-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10f9d06
commit f30fe5a
Showing
2 changed files
with
100 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters