Skip to content

Commit ed918ba

Browse files
Merge pull request #110 from github/ketchup/bumpPerPageCurrentBranch
Get and display all workflows, all jobs per workflow, and last 100 workflow runs in the extension view
2 parents ea64b27 + 695cfb9 commit ed918ba

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

src/store/workflowRun.ts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as vscode from "vscode";
12
import {GitHubRepoContext} from "../git/repository";
23
import {RepositoryPermission, hasWritePermission} from "../git/repository-permissions";
34
import {log, logDebug} from "../log";
@@ -76,14 +77,22 @@ export class WorkflowRun extends WorkflowRunBase {
7677
override async fetchJobs(): Promise<WorkflowJob[]> {
7778
logDebug("Getting workflow jobs");
7879

79-
const result = await this._gitHubRepoContext.client.actions.listJobsForWorkflowRun({
80-
owner: this._gitHubRepoContext.owner,
81-
repo: this._gitHubRepoContext.name,
82-
run_id: this.run.id
83-
});
80+
let jobs: model.WorkflowJob[] = [];
81+
82+
try {
83+
jobs = await this._gitHubRepoContext.client.paginate(
84+
this._gitHubRepoContext.client.actions.listJobsForWorkflowRun,
85+
{
86+
owner: this._gitHubRepoContext.owner,
87+
repo: this._gitHubRepoContext.name,
88+
run_id: this.run.id,
89+
per_page: 100
90+
}
91+
);
92+
} catch (e) {
93+
await vscode.window.showErrorMessage((e as Error).message);
94+
}
8495

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

@@ -139,16 +148,23 @@ export class WorkflowRunAttempt extends WorkflowRunBase {
139148

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

143-
const result = await this._gitHubRepoContext.client.actions.listJobsForWorkflowRunAttempt({
144-
owner: this._gitHubRepoContext.owner,
145-
repo: this._gitHubRepoContext.name,
146-
run_id: this._run.id,
147-
attempt_number: this.attempt
148-
});
153+
try {
154+
jobs = await this._gitHubRepoContext.client.paginate(
155+
this._gitHubRepoContext.client.actions.listJobsForWorkflowRunAttempt,
156+
{
157+
owner: this._gitHubRepoContext.owner,
158+
repo: this._gitHubRepoContext.name,
159+
run_id: this.run.id,
160+
attempt_number: this.attempt,
161+
per_page: 100
162+
}
163+
);
164+
} catch (e) {
165+
await vscode.window.showErrorMessage((e as Error).message);
166+
}
149167

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

src/treeViews/currentBranch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ export class CurrentBranchTreeProvider
107107
const result = await gitHubRepoContext.client.actions.listWorkflowRunsForRepo({
108108
owner: gitHubRepoContext.owner,
109109
repo: gitHubRepoContext.name,
110-
branch: currentBranchName
110+
branch: currentBranchName,
111+
per_page: 100
111112
});
112113

113114
const resp = result.data;

0 commit comments

Comments
 (0)