Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added octokit parser
Browse files Browse the repository at this point in the history
nbhoski committed Jun 13, 2024
1 parent d124001 commit 7294747
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
@@ -86,24 +86,26 @@ 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);
getWorkflowRunJobs(owner as string, repo as string, runId as string);
// const runId = process.env.GITHUB_RUN_ID
//console.log(runId);
const path = '.github/workflows/' + process.env.GITHUB_WORKFLOW
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.listJobsForWorkflowRun({
const response = await octokit.actions.getContent({
owner,
repo,
runId,
path,
});

// Iterate over the jobs and log the step names

0 comments on commit 7294747

Please sign in to comment.