Skip to content

Commit c1f9c52

Browse files
committed
Actions.WorkflowJobs Data classes added
Added the classes that will hold the responses from the actions.workflowjobs api's Get and List calls.
1 parent 7da264e commit c1f9c52

File tree

6 files changed

+424
-0
lines changed

6 files changed

+424
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*-
2+
* -\-\-
3+
* github-api
4+
* --
5+
* Copyright (C) 2016 - 2020 Spotify AB
6+
* --
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* -/-/-
19+
*/
20+
21+
package com.spotify.github.v3.actions.workflowjobs;
22+
23+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
24+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
25+
import com.spotify.github.GithubStyle;
26+
import com.spotify.github.Parameters;
27+
import org.immutables.value.Value;
28+
29+
import java.util.Optional;
30+
31+
@Value.Immutable
32+
@GithubStyle
33+
@JsonSerialize(as = ImmutableListWorkflowJobsQueryParams.class)
34+
@JsonDeserialize(as = ImmutableListWorkflowJobsQueryParams.class)
35+
public interface ListWorkflowJobsQueryParams extends Parameters {
36+
Optional<Filter> filter();
37+
38+
/**
39+
* The number of results per page (max 100). For more information, see "Using pagination in the REST API."
40+
* &gt;p&lt;
41+
* Default: 30
42+
*/
43+
Optional<Integer> perPage();
44+
45+
/**
46+
* The page number of the results to fetch. For more information, see "Using pagination in the REST API."
47+
* &gt;p&lt;
48+
* Default: 1
49+
*/
50+
Optional<Integer> page();
51+
52+
enum Filter {
53+
latest,
54+
completed_at,
55+
all
56+
}
57+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*-
2+
* -\-\-
3+
* github-api
4+
* --
5+
* Copyright (C) 2016 - 2020 Spotify AB
6+
* --
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* -/-/-
19+
*/
20+
21+
package com.spotify.github.v3.actions.workflowjobs;
22+
23+
/**
24+
* The possible status values of a WorkflowJob's status field.
25+
* &gt;p/&lt;
26+
* Value of the status property can be one of: "queued", "in_progress", or "completed". Only GitHub Actions can set a status of "waiting", "pending", or "requested".
27+
* When it’s “completed,” it makes sense to check if it finished successfully. We need a value of the conclusion property.
28+
* Conclusion Can be one of the “success”, “failure”, “neutral”, “cancelled”, “skipped”, “timed_out”, or “action_required”.
29+
* &gt;p/&lt;
30+
* &#064;See <a href="https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository">The GitHub API docs</a>
31+
* &#064;See also <a href="https://github.com/github/rest-api-description/issues/1634#issuecomment-2230666873">GitHub rest api docs issue #1634</a>
32+
*/
33+
public enum WorkflowJobConclusion {
34+
success,
35+
failure,
36+
neutral,
37+
cancelled,
38+
skipped,
39+
timed_out,
40+
action_required
41+
}
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/*-
2+
* -\-\-
3+
* github-api
4+
* --
5+
* Copyright (C) 2016 - 2020 Spotify AB
6+
* --
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* -/-/-
19+
*/
20+
21+
package com.spotify.github.v3.actions.workflowjobs;
22+
23+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
24+
import com.spotify.github.GithubStyle;
25+
import org.immutables.value.Value;
26+
27+
import javax.annotation.Nullable;
28+
import java.time.ZonedDateTime;
29+
import java.util.List;
30+
31+
@Value.Immutable
32+
@GithubStyle
33+
@JsonDeserialize(as = ImmutableWorkflowJobResponse.class)
34+
public interface WorkflowJobResponse {
35+
/**
36+
* The id of the job.
37+
* (Required)
38+
*/
39+
long id();
40+
41+
/**
42+
* The id of the associated workflow run.
43+
* (Required)
44+
*/
45+
long runId();
46+
47+
/**
48+
* (Required)
49+
*/
50+
String runUrl();
51+
52+
/**
53+
* Attempt number of the associated workflow run, 1 for first attempt and higher if the workflow was re-run.
54+
*/
55+
@Nullable
56+
Integer runAttempt();
57+
58+
/**
59+
* (Required)
60+
*/
61+
String nodeId();
62+
63+
/**
64+
* The SHA of the commit that is being run.
65+
* (Required)
66+
*/
67+
String headSha();
68+
69+
/**
70+
* (Required)
71+
*/
72+
String url();
73+
74+
/**
75+
* (Required)
76+
*/
77+
String htmlUrl();
78+
79+
/**
80+
* The phase of the lifecycle that the job is currently in.
81+
* (Required)
82+
*/
83+
WorkflowJobStatus status();
84+
85+
/**
86+
* The outcome of the job.
87+
* (Required)
88+
*/
89+
WorkflowJobConclusion conclusion();
90+
91+
/**
92+
* The time that the job created, in ISO 8601 format.
93+
*/
94+
@Nullable
95+
ZonedDateTime createdAt();
96+
97+
/**
98+
* The time that the job started, in ISO 8601 format.
99+
* (Required)
100+
*/
101+
ZonedDateTime startedAt();
102+
103+
/**
104+
* The time that the job finished, in ISO 8601 format.
105+
* (Required)
106+
*/
107+
ZonedDateTime completedAt();
108+
109+
/**
110+
* The name of the job.
111+
* (Required)
112+
*/
113+
String name();
114+
115+
/**
116+
* Steps in this job.
117+
*/
118+
@Nullable
119+
List<WorkflowJobStep> steps();
120+
121+
/**
122+
* (Required)
123+
*/
124+
String checkRunUrl();
125+
126+
/**
127+
* Labels for the workflow job. Specified by the "runs_on" attribute in the action's workflow file.
128+
* (Required)
129+
*/
130+
List<String> labels();
131+
132+
/**
133+
* The ID of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
134+
* (Required)
135+
*/
136+
int runnerId();
137+
138+
/**
139+
* The name of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
140+
* (Required)
141+
*/
142+
String runnerName();
143+
144+
/**
145+
* The ID of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
146+
* (Required)
147+
*/
148+
int runnerGroupId();
149+
150+
/**
151+
* The name of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
152+
* (Required)
153+
*/
154+
String runnerGroupName();
155+
156+
/**
157+
* The name of the workflow.
158+
* (Required)
159+
*/
160+
String workflowName();
161+
162+
/**
163+
* The name of the current branch.
164+
* (Required)
165+
*/
166+
String headBranch();
167+
}
168+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*-
2+
* -\-\-
3+
* github-api
4+
* --
5+
* Copyright (C) 2016 - 2020 Spotify AB
6+
* --
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* -/-/-
19+
*/
20+
21+
package com.spotify.github.v3.actions.workflowjobs;
22+
23+
/**
24+
* The possible status values of a WorkflowJob's status field.
25+
* &gt;p/&lt;
26+
* Value of the status property can be one of: "queued", "in_progress", or "completed". Only GitHub Actions can set a status of "waiting", "pending", or "requested".
27+
* When it’s “completed,” it makes sense to check if it finished successfully. We need a value of the conclusion property.
28+
* Conclusion Can be one of the “success”, “failure”, “neutral”, “cancelled”, “skipped”, “timed_out”, or “action_required”.
29+
* &gt;p/&lt;
30+
* &#064;See <a href="https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository">The GitHub API docs</a>
31+
* &#064;See also <a href="https://github.com/github/rest-api-description/issues/1634#issuecomment-2230666873">GitHub rest api docs issue #1634</a>
32+
*/
33+
public enum WorkflowJobStatus {
34+
completed,
35+
in_progress,
36+
queued,
37+
requested,
38+
waiting,
39+
pending
40+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*-
2+
* -\-\-
3+
* github-api
4+
* --
5+
* Copyright (C) 2016 - 2020 Spotify AB
6+
* --
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* -/-/-
19+
*/
20+
21+
package com.spotify.github.v3.actions.workflowjobs;
22+
23+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
24+
import com.spotify.github.GithubStyle;
25+
import org.immutables.value.Value;
26+
27+
import javax.annotation.Nullable;
28+
import java.time.ZonedDateTime;
29+
30+
@Value.Immutable
31+
@GithubStyle
32+
@JsonDeserialize(as = ImmutableWorkflowJobStep.class)
33+
public interface WorkflowJobStep {
34+
35+
/**
36+
* The phase of the lifecycle that the job is currently in.
37+
* (Required)
38+
*/
39+
WorkflowJobStatus status();
40+
41+
/**
42+
* The outcome of the job. Only set if status==completed
43+
*/
44+
@Nullable
45+
WorkflowJobConclusion conclusion();
46+
47+
/**
48+
* The name of the job.
49+
* (Required)
50+
*/
51+
String name();
52+
53+
/**
54+
* (Required)
55+
*/
56+
Integer number();
57+
58+
/**
59+
* The time that the step started, in ISO 8601 format.
60+
*/
61+
ZonedDateTime startedAt();
62+
63+
/**
64+
* The time that the job finished, in ISO 8601 format.
65+
*/
66+
ZonedDateTime completedAt();
67+
}

0 commit comments

Comments
 (0)