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 5bfae8b commit 552060a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,31 @@ 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);
//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, 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.listJobsForWorkflowRun({
owner,
repo,
path,
runID,
});

const contentEncoded = response.data.content;
const contentDecoded = Buffer.from(contentEncoded, 'base64').toString('utf-8');
const contentEncoded = response.data.jobs;
//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;


} catch (error) {
console.error(error);
Expand Down

0 comments on commit 552060a

Please sign in to comment.