Skip to content

Commit 674d08e

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

File tree

4 files changed

+436
-0
lines changed

4 files changed

+436
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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.workflowruns;
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 = ImmutableQueryParams.class)
34+
@JsonDeserialize(as = ImmutableQueryParams.class)
35+
public interface QueryParams extends Parameters {
36+
/**
37+
* Returns someone's workflow runs. Use the login for the user who created the push associated with the check suite or workflow run.
38+
*/
39+
Optional<String> actor();
40+
41+
/**
42+
* Returns workflow runs associated with a branch. Use the name of the branch of the push.
43+
*/
44+
Optional<String> branch();
45+
46+
/**
47+
* Returns workflow run triggered by the event you specify. For example, push, pull_request or issue. For more information, see "Events that trigger workflows."
48+
*/
49+
Optional<String> event();
50+
51+
/**
52+
* Returns workflow runs with the check run status or conclusion that you specify. For example, a conclusion can be success or a status can be in_progress. Only GitHub Actions can set a status of waiting, pending, or requested.
53+
* &gt;p&lt;
54+
* Can be one of: completed, action_required, cancelled, failure, neutral, skipped, stale, success, timed_out, in_progress, queued, requested, waiting, pending
55+
*/
56+
Optional<WorkflowRunStatus> status();
57+
58+
/**
59+
* The number of results per page (max 100). For more information, see "Using pagination in the REST API."
60+
* &gt;p&lt;
61+
* Default: 30
62+
*/
63+
Optional<Integer> perPage();
64+
65+
/**
66+
* The page number of the results to fetch. For more information, see "Using pagination in the REST API."
67+
* &gt;p&lt;
68+
* Default: 1
69+
*/
70+
Optional<Integer> page();
71+
72+
/**
73+
* Returns workflow runs created within the given date-time range. Syntax with examples:
74+
* &gt;p&lt;
75+
* &lt;YYYY-MM-DD created:&lt;2016-04-29 matches workflow runs that were created after April 29, 2016.
76+
* &lt;=YYYY-MM-DD created:&lt;=2017-04-01 matches workflow runs that were created on or after April 1, 2017.
77+
* &gt;YYYY-MM-DD pushed:&gt;2012-07-05 matches workflow runs that were pushed to before July 5, 2012.
78+
* &gt;=YYYY-MM-DD created:&gt;=2012-07-04 matches workflow runs that were created on or before July 4, 2012.
79+
* YYYY-MM-DD..YYYY-MM-DD pushed:2016-04-30..2016-07-04 matches workflow runs that were pushed to between the end of April and July of 2016.
80+
* YYYY-MM-DD..* created:2012-04-30..* matches workflow runs created on or after April 30th, 2012 containing the word "cats."
81+
* *..YYYY-MM-DD created:*..2012-07-04 matches workflow runs created on or before July 4th, 2012 containing the word "cats."
82+
* &gt;p&lt;
83+
* You can also add optional time information THH:MM:SS+00:00 after the date, to filter by the hour, minute, and second. That's T, followed by HH:MM:SS (hour-minutes-seconds), and a UTC offset (+00:00).
84+
* &gt;p&lt;
85+
* Query Example
86+
* YYYY-MM-DDTHH:MM:SS+00:00 created:2017-01-01T01:00:00+07:00..2017-03-01T15:30:15+07:00 matches workflow runs created between January 1, 2017 at 1 a.m. with a UTC offset of 07:00 and March 1, 2017 at 3 p.m. with a UTC offset of 07:00.
87+
* YYYY-MM-DDTHH:MM:SSZ created:2016-03-21T14:11:00Z..2016-04-07T20:45:00Z matches workflow runs created between March 21, 2016 at 2:11pm and April 7, 2016 at 8:45pm.
88+
*/
89+
Optional<String> created();
90+
91+
/**
92+
* If true pull requests are omitted from the response (empty array).
93+
* &gt;p&lt;
94+
* Default: false
95+
*/
96+
Optional<Boolean> excludePullRequests();
97+
98+
/**
99+
* Returns workflow runs with the check_suite_id that you specify.
100+
*/
101+
Optional<Integer> checkSuiteId();
102+
103+
/**
104+
* Only returns workflow runs that are associated with the specified head_sha.
105+
*/
106+
Optional<String> headSha();
107+
}
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
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.workflowruns;
22+
23+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
24+
import com.spotify.github.GithubStyle;
25+
import com.spotify.github.v3.User;
26+
import com.spotify.github.v3.prs.PullRequestItem;
27+
import com.spotify.github.v3.repos.PushCommit;
28+
import org.immutables.value.Value;
29+
30+
import javax.annotation.Nullable;
31+
import java.time.ZonedDateTime;
32+
import java.util.List;
33+
34+
@Value.Immutable
35+
@GithubStyle
36+
@JsonDeserialize(as = ImmutableWorkflowRunResponse.class)
37+
public interface WorkflowRunResponse {
38+
39+
/**
40+
* The ID of the Workflow Run.
41+
* (Required)
42+
*/
43+
long id();
44+
45+
/**
46+
* The name of the Workflow Run.
47+
* Not required as per schema.
48+
*/
49+
@Nullable
50+
String name();
51+
52+
/**
53+
* Github api node id. See <a href="https://docs.github.com/en/graphql/guides/using-global-node-ids">Using Global Node ids</a>
54+
* (Required)
55+
*/
56+
String nodeId();
57+
58+
/**
59+
* The ID of the associated check suite.
60+
* Not required as per schema.
61+
*/
62+
@Nullable
63+
Long checkSuiteId();
64+
65+
/**
66+
* The node ID of the associated check suite.
67+
* Not required as per schema.
68+
*/
69+
@Nullable
70+
String checkSuiteNodeId();
71+
72+
/**
73+
* The branch of the head commit that points to the version of the workflow being run.
74+
* (Required)
75+
*/
76+
String headBranch();
77+
78+
/**
79+
* The SHA of the head commit that points to the version of the workflow being run.
80+
* (Required)
81+
*/
82+
String headSha();
83+
84+
/**
85+
* The full path of the workflow
86+
* (Required)
87+
*/
88+
String path();
89+
90+
/**
91+
* The auto incrementing run number for the Workflow Run.
92+
* (Required)
93+
*/
94+
Integer runNumber();
95+
96+
/**
97+
* Attempt number of the run, 1 for first attempt and higher if the workflow was re-run.
98+
* Not required as per schema.
99+
*/
100+
@Nullable
101+
Integer runAttempt();
102+
103+
/**
104+
* The event that lead to the trigger of this Workflow Run
105+
* (Required)
106+
*/
107+
String event();
108+
109+
/**
110+
* The status of this Workflow Run.
111+
* (Required)
112+
*/
113+
WorkflowRunStatus status();
114+
115+
/**
116+
* The result of the run.
117+
*/
118+
@Nullable
119+
String conclusion();
120+
121+
/**
122+
* The ID of the parent workflow.
123+
* (Required)
124+
*/
125+
Integer workflowId();
126+
127+
/**
128+
* The URL to the Workflow Run.
129+
* (Required)
130+
*/
131+
String url();
132+
133+
/**
134+
* URL for viewing the Workflow run on a browser
135+
* (Required)
136+
*/
137+
String htmlUrl();
138+
139+
/**
140+
* When the Workflow Run was created
141+
* (Required)
142+
*/
143+
ZonedDateTime createdAt();
144+
145+
/**
146+
* When the Workflow Run was last updated
147+
* (Required)
148+
*/
149+
ZonedDateTime updatedAt();
150+
151+
/**
152+
* The start time of the latest run. Resets on re-run.
153+
* Not required as per schema.
154+
*/
155+
@Nullable
156+
ZonedDateTime runStartedAt();
157+
158+
/**
159+
* The URL to the jobs for the Workflow Run.
160+
* (Required)
161+
*/
162+
String jobsUrl();
163+
164+
/**
165+
* The URL to download the logs for the Workflow Run.
166+
* (Required)
167+
*/
168+
String logsUrl();
169+
170+
/**
171+
* The URL to the associated check suite.
172+
* (Required)
173+
*/
174+
String checkSuiteUrl();
175+
176+
/**
177+
* The URL to the artifacts for the Workflow Run.
178+
* (Required)
179+
*/
180+
String artifactsUrl();
181+
182+
/**
183+
* The URL to cancel the Workflow Run.
184+
* (Required)
185+
*/
186+
String cancelUrl();
187+
188+
/**
189+
* The URL to rerun the Workflow Run.
190+
* (Required)
191+
*/
192+
String rerunUrl();
193+
194+
/**
195+
* The URL to the previous attempted run of this workflow, if one exists.
196+
* Not required as per schema.
197+
*/
198+
@Nullable
199+
String previousAttemptUrl();
200+
201+
/**
202+
* The URL to the workflow.
203+
* (Required)
204+
*/
205+
String workflowUrl();
206+
207+
/**
208+
* The event-specific title associated with the run or the run-name if set, or the value of `run-name` if it is set in the workflow.
209+
* (Required)
210+
*/
211+
String displayTitle();
212+
213+
/**
214+
* Pull requests that are open with a `head_sha` or `head_branch` that matches the Workflow Run. The returned pull requests do not necessarily indicate pull requests that triggered the run.
215+
* (Required)
216+
*/
217+
List<PullRequestItem> pullRequests();
218+
219+
/**
220+
* The GitHub user that triggered the initial Workflow Run. If the Workflow Run is a re-run, this value may differ from triggeringActor. Any workflow re-runs will use the privileges of actor, even if the actor initiating the re-run (triggeringActor) has different privileges.
221+
* Not required as per schema.
222+
*/
223+
@Nullable
224+
User actor();
225+
226+
/**
227+
* The GitHub user that initiated the Workflow Run. If the Workflow Run is a re-run, this value may differ from actor. Any workflow re-runs will use the privileges of actor, even if the actor initiating the re-run (triggeringActor) has different privileges.
228+
* Not required as per schema.
229+
*/
230+
@Nullable
231+
User triggeringActor();
232+
233+
/**
234+
* The head commit that points to the version of code the workflow being run on.
235+
* <p>
236+
* (Required)
237+
*/
238+
PushCommit headCommit();
239+
}
240+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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.workflowruns;
22+
23+
public enum WorkflowRunStatus {
24+
completed,
25+
action_required,
26+
cancelled,
27+
failure,
28+
neutral,
29+
skipped,
30+
stale,
31+
success,
32+
timed_out,
33+
in_progress,
34+
queued,
35+
requested,
36+
waiting,
37+
pending
38+
}

0 commit comments

Comments
 (0)