From 03961c6f1e7ec08d9451ed3dbdf88424fee2ad29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Bokvad=20Engar=C3=A5s?= Date: Fri, 8 Sep 2023 08:20:35 +0200 Subject: [PATCH] test --- .../BranchProtectionService.ts | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/branchprotection/BranchProtectionService.ts b/src/branchprotection/BranchProtectionService.ts index 669ff802..a6efbdcc 100644 --- a/src/branchprotection/BranchProtectionService.ts +++ b/src/branchprotection/BranchProtectionService.ts @@ -1,30 +1,32 @@ import * as core from '@actions/core'; import * as github from '@actions/github'; -export class BranchProtectionService{ +export class BranchProtectionService { + public static async getStateOfBranchProtection(): Promise { + console.log('Custom task is working!'); + const token = core.getInput('repo-token'); + console.log('Got the token'); - public static async getStateOfBranchProtection(): Promise { - console.log('Custom task is working!'); - 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 branch protection"); - await octokit.rest.repos.getBranchProtection({ + console.log('Going to get branch protection'); + await octokit.rest.repos + .getBranchProtection({ 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); - }); - } -} \ No newline at end of file + }) + .then((response) => { + console.log('Got the branch protection'); + console.log(response.data); + }) + .catch((error) => { + core.warning('Error getting branch protection!'); + console.log('Error: ', error); + }); + } +}