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 9d3fa91 commit ebcce8e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,32 +86,34 @@ export function getWorkflowStepNames(repository: string) {
const [owner, repo] = repository.split('/');
console.log(owner);
console.log(repo);
// const runId = process.env.GITHUB_RUN_ID
//console.log(runId);
const path = '.github/workflows/bat.yml';
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, path as string);
getWorkflowRunJobs(owner as string, repo as string, runId as string);
}


export async function getWorkflowRunJobs(owner: string, repo: string, path: string) {
export async function getWorkflowRunJobs(owner: string, repo: string, runId: 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.repos.getContent({
const response = await octokit.actions.getWorkflowRun({
owner,
repo,
path,
runId,
});

// Iterate over the jobs and log the step names
console.log(response);
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 ebcce8e

Please sign in to comment.