From 2fd9c61b4f2ae038a701ea6c2fded7223ed85830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Bokvad=20Engar=C3=A5s?= Date: Thu, 7 Sep 2023 17:21:32 +0200 Subject: [PATCH] Fixed json path --- src/Pentest/PentestService.ts | 38 +++++++++++++++++++++++++---------- src/index.ts | 4 ++-- 2 files changed, 29 insertions(+), 13 deletions(-) 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();