Skip to content

Commit fc98e72

Browse files
committed
Rename GHWorkflowRunJob to GHWorkflowJob
1 parent 258acf7 commit fc98e72

File tree

7 files changed

+37
-38
lines changed

7 files changed

+37
-38
lines changed

src/main/java/org/kohsuke/github/GHRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,10 +3061,10 @@ public GHArtifact getArtifact(long id) throws IOException {
30613061
* @throws IOException
30623062
* the io exception
30633063
*/
3064-
public GHWorkflowRunJob getWorkflowRunJob(long id) throws IOException {
3064+
public GHWorkflowJob getWorkflowJob(long id) throws IOException {
30653065
return root.createRequest()
30663066
.withUrlPath(getApiTailUrl("/actions/jobs/"), String.valueOf(id))
3067-
.fetch(GHWorkflowRunJob.class)
3067+
.fetch(GHWorkflowJob.class)
30683068
.wrapUp(this);
30693069
}
30703070

src/main/java/org/kohsuke/github/GHWorkflowRunJob.java renamed to src/main/java/org/kohsuke/github/GHWorkflowJob.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Guillaume Smet
2222
*/
23-
public class GHWorkflowRunJob extends GHObject {
23+
public class GHWorkflowJob extends GHObject {
2424

2525
// Not provided by the API.
2626
@JsonIgnore
@@ -171,12 +171,12 @@ private String getApiRoute() {
171171
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/actions/jobs/" + getId();
172172
}
173173

174-
GHWorkflowRunJob wrapUp(GHRepository owner) {
174+
GHWorkflowJob wrapUp(GHRepository owner) {
175175
this.owner = owner;
176176
return wrapUp(owner.root);
177177
}
178178

179-
GHWorkflowRunJob wrapUp(GitHub root) {
179+
GHWorkflowJob wrapUp(GitHub root) {
180180
this.root = root;
181181
if (owner != null) {
182182
owner.wrap(root);

src/main/java/org/kohsuke/github/GHWorkflowRunJobQueryBuilder.java renamed to src/main/java/org/kohsuke/github/GHWorkflowJobQueryBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
*
88
* @author Guillaume Smet
99
*/
10-
public class GHWorkflowRunJobQueryBuilder extends GHQueryBuilder<GHWorkflowRunJob> {
10+
public class GHWorkflowJobQueryBuilder extends GHQueryBuilder<GHWorkflowJob> {
1111
private final GHRepository repo;
1212

13-
GHWorkflowRunJobQueryBuilder(GHWorkflowRun workflowRun) {
13+
GHWorkflowJobQueryBuilder(GHWorkflowRun workflowRun) {
1414
super(workflowRun.getRepository().root);
1515
this.repo = workflowRun.getRepository();
1616
req.withUrlPath(repo.getApiTailUrl("actions/runs"), String.valueOf(workflowRun.getId()), "jobs");
@@ -21,7 +21,7 @@ public class GHWorkflowRunJobQueryBuilder extends GHQueryBuilder<GHWorkflowRunJo
2121
*
2222
* @return the workflow run job query builder
2323
*/
24-
public GHWorkflowRunJobQueryBuilder latest() {
24+
public GHWorkflowJobQueryBuilder latest() {
2525
req.with("filter", "latest");
2626
return this;
2727
}
@@ -31,15 +31,15 @@ public GHWorkflowRunJobQueryBuilder latest() {
3131
*
3232
* @return the workflow run job run query builder
3333
*/
34-
public GHWorkflowRunJobQueryBuilder all() {
34+
public GHWorkflowJobQueryBuilder all() {
3535
req.with("filter", "all");
3636
return this;
3737
}
3838

3939
@Override
40-
public PagedIterable<GHWorkflowRunJob> list() {
40+
public PagedIterable<GHWorkflowJob> list() {
4141
try {
42-
return new GHWorkflowRunJobsIterable(repo, req.build());
42+
return new GHWorkflowJobsIterable(repo, req.build());
4343
} catch (MalformedURLException e) {
4444
throw new GHException(e.getMessage(), e);
4545
}

src/main/java/org/kohsuke/github/GHWorkflowRunJobsIterable.java renamed to src/main/java/org/kohsuke/github/GHWorkflowJobsIterable.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@
77
/**
88
* Iterable for workflow run jobs listing.
99
*/
10-
class GHWorkflowRunJobsIterable extends PagedIterable<GHWorkflowRunJob> {
10+
class GHWorkflowJobsIterable extends PagedIterable<GHWorkflowJob> {
1111
private final GHRepository repo;
1212
private final GitHubRequest request;
1313

14-
private GHWorkflowRunJobsPage result;
14+
private GHWorkflowJobsPage result;
1515

16-
public GHWorkflowRunJobsIterable(GHRepository repo, GitHubRequest request) {
16+
public GHWorkflowJobsIterable(GHRepository repo, GitHubRequest request) {
1717
this.repo = repo;
1818
this.request = request;
1919
}
2020

2121
@Nonnull
2222
@Override
23-
public PagedIterator<GHWorkflowRunJob> _iterator(int pageSize) {
23+
public PagedIterator<GHWorkflowJob> _iterator(int pageSize) {
2424
return new PagedIterator<>(
25-
adapt(GitHubPageIterator.create(repo.root.getClient(), GHWorkflowRunJobsPage.class, request, pageSize)),
25+
adapt(GitHubPageIterator.create(repo.root.getClient(), GHWorkflowJobsPage.class, request, pageSize)),
2626
null);
2727
}
2828

29-
protected Iterator<GHWorkflowRunJob[]> adapt(final Iterator<GHWorkflowRunJobsPage> base) {
30-
return new Iterator<GHWorkflowRunJob[]>() {
29+
protected Iterator<GHWorkflowJob[]> adapt(final Iterator<GHWorkflowJobsPage> base) {
30+
return new Iterator<GHWorkflowJob[]>() {
3131
public boolean hasNext() {
3232
return base.hasNext();
3333
}
3434

35-
public GHWorkflowRunJob[] next() {
36-
GHWorkflowRunJobsPage v = base.next();
35+
public GHWorkflowJob[] next() {
36+
GHWorkflowJobsPage v = base.next();
3737
if (result == null) {
3838
result = v;
3939
}
40-
return v.getWorkflowRunJobs(repo);
40+
return v.getWorkflowJobs(repo);
4141
}
4242
};
4343
}

src/main/java/org/kohsuke/github/GHWorkflowRunJobsPage.java renamed to src/main/java/org/kohsuke/github/GHWorkflowJobsPage.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
/**
44
* Represents the one page of jobs result when listing jobs from a workflow run.
55
*/
6-
class GHWorkflowRunJobsPage {
6+
class GHWorkflowJobsPage {
77
private int total_count;
8-
private GHWorkflowRunJob[] jobs;
8+
private GHWorkflowJob[] jobs;
99

1010
public int getTotalCount() {
1111
return total_count;
1212
}
1313

14-
GHWorkflowRunJob[] getWorkflowRunJobs(GHRepository repo) {
15-
for (GHWorkflowRunJob job : jobs) {
14+
GHWorkflowJob[] getWorkflowJobs(GHRepository repo) {
15+
for (GHWorkflowJob job : jobs) {
1616
job.wrapUp(repo);
1717
}
1818
return jobs;

src/main/java/org/kohsuke/github/GHWorkflowRun.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,17 @@ public void deleteLogs() throws IOException {
318318
*
319319
* @return list of jobs from the last execution
320320
*/
321-
public PagedIterable<GHWorkflowRunJob> listJobs() {
322-
return new GHWorkflowRunJobQueryBuilder(this).latest().list();
321+
public PagedIterable<GHWorkflowJob> listJobs() {
322+
return new GHWorkflowJobQueryBuilder(this).latest().list();
323323
}
324324

325325
/**
326326
* Returns this list of jobs from all the executions of this workflow run.
327327
*
328328
* @return list of jobs from all the executions
329329
*/
330-
public PagedIterable<GHWorkflowRunJob> listAllJobs() {
331-
return new GHWorkflowRunJobQueryBuilder(this).all().list();
330+
public PagedIterable<GHWorkflowJob> listAllJobs() {
331+
return new GHWorkflowJobQueryBuilder(this).all().list();
332332
}
333333

334334
private String getApiRoute() {

src/test/java/org/kohsuke/github/GHWorkflowRunTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import org.junit.Assert;
55
import org.junit.Before;
66
import org.junit.Test;
7+
import org.kohsuke.github.GHWorkflowJob.Step;
78
import org.kohsuke.github.GHWorkflowRun.Conclusion;
89
import org.kohsuke.github.GHWorkflowRun.Status;
9-
import org.kohsuke.github.GHWorkflowRunJob.Step;
1010
import org.kohsuke.github.function.InputStreamFunction;
1111

1212
import java.io.IOException;
@@ -339,30 +339,30 @@ public void testJobs() throws IOException {
339339
latestPreexistingWorkflowRunId).orElseThrow(
340340
() -> new IllegalStateException("We must have a valid workflow run starting from here"));
341341

342-
List<GHWorkflowRunJob> jobs = workflowRun.listJobs()
342+
List<GHWorkflowJob> jobs = workflowRun.listJobs()
343343
.toList()
344344
.stream()
345345
.sorted((j1, j2) -> j1.getName().compareTo(j2.getName()))
346346
.collect(Collectors.toList());
347347

348348
assertThat(jobs.size(), is(2));
349349

350-
GHWorkflowRunJob job1 = jobs.get(0);
350+
GHWorkflowJob job1 = jobs.get(0);
351351
checkJobProperties(workflowRun.getId(), job1, "job1");
352352
String fullLogContent = job1.downloadLogs(getLogTextInputStreamFunction());
353353
assertThat(fullLogContent, containsString("Hello from job1!"));
354354

355-
GHWorkflowRunJob job2 = jobs.get(1);
355+
GHWorkflowJob job2 = jobs.get(1);
356356
checkJobProperties(workflowRun.getId(), job2, "job2");
357357
fullLogContent = job2.downloadLogs(getLogTextInputStreamFunction());
358358
assertThat(fullLogContent, containsString("Hello from job2!"));
359359

360-
// while we have a job around, test GHRepository#getWorkflowRunJob(id)
361-
GHWorkflowRunJob job1ById = repo.getWorkflowRunJob(job1.getId());
360+
// while we have a job around, test GHRepository#getWorkflowJob(id)
361+
GHWorkflowJob job1ById = repo.getWorkflowJob(job1.getId());
362362
checkJobProperties(workflowRun.getId(), job1ById, "job1");
363363

364364
// Also test listAllJobs() works correctly
365-
List<GHWorkflowRunJob> allJobs = workflowRun.listAllJobs().withPageSize(10).iterator().nextPage();
365+
List<GHWorkflowJob> allJobs = workflowRun.listAllJobs().withPageSize(10).iterator().nextPage();
366366
assertThat(allJobs.size(), greaterThanOrEqualTo(2));
367367
}
368368

@@ -468,8 +468,7 @@ private static void checkArtifactProperties(GHArtifact artifact, String artifact
468468
assertFalse(artifact.isExpired());
469469
}
470470

471-
private static void checkJobProperties(long workflowRunId, GHWorkflowRunJob job, String jobName)
472-
throws IOException {
471+
private static void checkJobProperties(long workflowRunId, GHWorkflowJob job, String jobName) throws IOException {
473472
assertNotNull(job.getId());
474473
assertNotNull(job.getNodeId());
475474
assertEquals(REPO_NAME, job.getRepository().getFullName());

0 commit comments

Comments
 (0)