diff --git a/src/Pentest/PentestService.ts b/src/Pentest/PentestService.ts index c92e949a..28e3012f 100644 --- a/src/Pentest/PentestService.ts +++ b/src/Pentest/PentestService.ts @@ -14,20 +14,36 @@ export class PentestService { } core.setOutput("pentestDate", pentestDate.date); - - // const token = core.getInput('repo-token'); - // console.log("Got the token"); - // const octokit = github.getOctokit(token); - // console.log("octoKit authenticated"); + const token = core.getInput('repo-token'); + console.log("Got the token"); - // const { owner, repo } = github.context.repo; - // console.log(`Owner: ${owner}`); - // console.log(`Repo: ${repo}`); - - // console.log("Going to get branch protection"); - // await octokit.rest.repos.getBranchProtection({ + const octokit = github.getOctokit(token); + console.log("octoKit authenticated"); + + const { owner, repo } = github.context.repo; + console.log(`Owner: ${owner}`); + console.log(`Repo: ${repo}`); + + console.log("Going to get branch protection"); + await octokit.rest.projects.listCards({ + owner: owner, + repo: repo, + column_id: 123456789, + + }).then((response) => { + console.log("Got the cards"); + const projectCards = response.data; + const customLabelCards = projectCards.filter((card) => { + return card.note?.includes(pentestDate.boardsTag); + }); + + + }).catch((error) => { + core.warning("Error getting cards!"); + core.warning("Error: ", error.message); + }); // owner: owner, // repo: repo, // branch: 'main', diff --git a/src/index.ts b/src/index.ts index 2cabae1b..2130cd56 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,9 +10,9 @@ import { PentestService } from './Pentest/PentestService'; */ export async function run(): Promise { try { - const cydigConfig: CyDigConfig = getContentOfFile("./cydigconfig.json"); + const cydigConfig: CyDigConfig = getContentOfFile("cydigconfig.json"); await PentestService.getStateOfPentest(cydigConfig.pentest); - + await BranchProtectionService.getStateOfBranchProtection();