Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions src/store/workflowRun.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as vscode from "vscode";
import {GitHubRepoContext} from "../git/repository";
import {RepositoryPermission, hasWritePermission} from "../git/repository-permissions";
import {log, logDebug} from "../log";
Expand Down Expand Up @@ -76,14 +77,22 @@ export class WorkflowRun extends WorkflowRunBase {
override async fetchJobs(): Promise<WorkflowJob[]> {
logDebug("Getting workflow jobs");

const result = await this._gitHubRepoContext.client.actions.listJobsForWorkflowRun({
owner: this._gitHubRepoContext.owner,
repo: this._gitHubRepoContext.name,
run_id: this.run.id
});
let jobs: model.WorkflowJob[] = [];

try {
jobs = await this._gitHubRepoContext.client.paginate(
this._gitHubRepoContext.client.actions.listJobsForWorkflowRun,
{
owner: this._gitHubRepoContext.owner,
repo: this._gitHubRepoContext.name,
run_id: this.run.id,
per_page: 100
}
);
} catch (e) {
await vscode.window.showErrorMessage((e as Error).message);
}

const resp = result.data;
const jobs: model.WorkflowJob[] = resp.jobs;
return jobs.map(j => new WorkflowJob(this._gitHubRepoContext, j));
}

Expand Down Expand Up @@ -139,16 +148,23 @@ export class WorkflowRunAttempt extends WorkflowRunBase {

override async fetchJobs(): Promise<WorkflowJob[]> {
logDebug("Getting workflow run attempt jobs", this._run.id, "for attempt", this.attempt);
let jobs: model.WorkflowJob[] = [];

const result = await this._gitHubRepoContext.client.actions.listJobsForWorkflowRunAttempt({
owner: this._gitHubRepoContext.owner,
repo: this._gitHubRepoContext.name,
run_id: this._run.id,
attempt_number: this.attempt
});
try {
jobs = await this._gitHubRepoContext.client.paginate(
this._gitHubRepoContext.client.actions.listJobsForWorkflowRunAttempt,
{
owner: this._gitHubRepoContext.owner,
repo: this._gitHubRepoContext.name,
run_id: this.run.id,
attempt_number: this.attempt,
per_page: 100
}
);
} catch (e) {
await vscode.window.showErrorMessage((e as Error).message);
}

const resp = result.data;
const jobs: model.WorkflowJob[] = resp.jobs;
return jobs.map(j => new WorkflowJob(this._gitHubRepoContext, j));
}
}
3 changes: 2 additions & 1 deletion src/treeViews/currentBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export class CurrentBranchTreeProvider
const result = await gitHubRepoContext.client.actions.listWorkflowRunsForRepo({
owner: gitHubRepoContext.owner,
repo: gitHubRepoContext.name,
branch: currentBranchName
branch: currentBranchName,
per_page: 100
});

const resp = result.data;
Expand Down