Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanbokvad committed Sep 8, 2023
1 parent cc9a938 commit 03961c6
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/branchprotection/BranchProtectionService.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
console.log('Custom task is working!');
const token = core.getInput('repo-token');
console.log('Got the token');

public static async getStateOfBranchProtection(): Promise<void> {
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);
});
}
}
})
.then((response) => {
console.log('Got the branch protection');
console.log(response.data);
})
.catch((error) => {
core.warning('Error getting branch protection!');
console.log('Error: ', error);
});
}
}

0 comments on commit 03961c6

Please sign in to comment.