Skip to content

Commit

Permalink
Added octokit parser
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed Jun 13, 2024
1 parent 9d3d7f2 commit 5bfae8b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,32 +88,32 @@ export function getWorkflowStepNames(repository: string) {
console.log(repo);
const runId = process.env.GITHUB_RUN_ID
console.log(runId);
//const path = '.github/workflows/bat.yml';
//console.log(path);
getWorkflowRunJobs(owner as string, repo as string, runId as string);
const path = '.github/workflows/bat.yml';
console.log(path);
getWorkflowRunJobs(owner as string, repo as string, path as string);
}


export async function getWorkflowRunJobs(owner: string, repo: string, runId: string) {
export async function getWorkflowRunJobs(owner: string, repo: string, path: string) {
// Replace with your GitHub personal access token

const octokit = new Octokit({
auth: process.env.MY_GITHUB_TOKEN,
});
try {
// Fetch the jobs for the specified workflow run
const response = await octokit.actions.getWorkflowRun({
const response = await octokit.repos.getContent({
owner,
repo,
runId,
path,
});

const contentEncoded = response.data.content;
const contentDecoded = Buffer.from(contentEncoded, 'base64').toString('utf-8');
// Iterate over the jobs and log the step names
console.log(contentDecoded);
const jobs = response.data.jobs;

const jobs = response.data;
console.log(response);
const steps = jobs.steps;
console.log(steps);
} catch (error) {
console.error(error);
}
Expand Down

0 comments on commit 5bfae8b

Please sign in to comment.