Skip to content

Commit 1cee939

Browse files
author
Casey Hillers
authored
Merge pull request #315 from ricardoamador/add_skipped_conclusion
Added a new conclusion state to support flutter autosubmit bot
2 parents 921269b + 9f55646 commit 1cee939

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

lib/src/common/model/checks.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class CheckRunConclusion extends EnumWithValue {
4545
static const neutral = CheckRunConclusion._('neutral');
4646
static const cancelled = CheckRunConclusion._('cancelled');
4747
static const timedOut = CheckRunConclusion._('timed_out');
48+
static const skipped = CheckRunConclusion._('skipped');
4849
static const actionRequired = CheckRunConclusion._('action_required');
4950
static const empty = CheckRunConclusion._(null);
5051

@@ -60,6 +61,7 @@ class CheckRunConclusion extends EnumWithValue {
6061
neutral,
6162
cancelled,
6263
timedOut,
64+
skipped,
6365
actionRequired
6466
]) {
6567
if (level.value == value) {

test/unit/checks_test.dart

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,106 @@ void main() {
105105
expect(checkRun.name, 'mighty_readme');
106106
expect(checkRun.conclusion, CheckRunConclusion.neutral);
107107
});
108+
109+
test('CheckRun fromJson for skipped conclusion', () {
110+
/// The checkRun Json is the official Github values
111+
///
112+
/// Github api url: https://docs.github.com/en/rest/reference/checks#get-a-check-run
113+
const checkRunJson = '''{
114+
"id": 10,
115+
"head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
116+
"node_id": "MDg6Q2hlY2tSdW40",
117+
"external_id": "",
118+
"url": "https://api.github.com/repos/github/hello-world/check-runs/4",
119+
"html_url": "https://github.com/github/hello-world/runs/4",
120+
"details_url": "https://example.com",
121+
"status": "completed",
122+
"conclusion": "skipped",
123+
"started_at": "2018-05-04T01:14:52Z",
124+
"completed_at": "2018-05-04T01:14:52Z",
125+
"output": {
126+
"title": "Mighty Readme report",
127+
"summary": "There are 0 failures, 2 warnings, and 1 notice.",
128+
"text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.",
129+
"annotations_count": 2,
130+
"annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations"
131+
},
132+
"name": "mighty_readme",
133+
"check_suite": {
134+
"id": 5
135+
},
136+
"app": {
137+
"id": 1,
138+
"slug": "octoapp",
139+
"node_id": "MDExOkludGVncmF0aW9uMQ==",
140+
"owner": {
141+
"login": "github",
142+
"id": 1,
143+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
144+
"url": "https://api.github.com/orgs/github",
145+
"repos_url": "https://api.github.com/orgs/github/repos",
146+
"events_url": "https://api.github.com/orgs/github/events",
147+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
148+
"gravatar_id": "",
149+
"html_url": "https://github.com/octocat",
150+
"followers_url": "https://api.github.com/users/octocat/followers",
151+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
152+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
153+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
154+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
155+
"organizations_url": "https://api.github.com/users/octocat/orgs",
156+
"received_events_url": "https://api.github.com/users/octocat/received_events",
157+
"type": "User",
158+
"site_admin": true
159+
},
160+
"name": "Octocat App",
161+
"description": "",
162+
"external_url": "https://example.com",
163+
"html_url": "https://github.com/apps/octoapp",
164+
"created_at": "2017-07-08T16:18:44-04:00",
165+
"updated_at": "2017-07-08T16:18:44-04:00",
166+
"permissions": {
167+
"metadata": "read",
168+
"contents": "read",
169+
"issues": "write",
170+
"single_file": "write"
171+
},
172+
"events": [
173+
"push",
174+
"pull_request"
175+
]
176+
},
177+
"pull_requests": [
178+
{
179+
"url": "https://api.github.com/repos/github/hello-world/pulls/1",
180+
"id": 1934,
181+
"number": 3956,
182+
"head": {
183+
"ref": "say-hello",
184+
"sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390",
185+
"repo": {
186+
"id": 526,
187+
"url": "https://api.github.com/repos/github/hello-world",
188+
"name": "hello-world"
189+
}
190+
},
191+
"base": {
192+
"ref": "master",
193+
"sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f",
194+
"repo": {
195+
"id": 526,
196+
"url": "https://api.github.com/repos/github/hello-world",
197+
"name": "hello-world"
198+
}
199+
}
200+
}
201+
]
202+
}''';
203+
final checkRun = CheckRun.fromJson(jsonDecode(checkRunJson));
204+
205+
expect(checkRun.id, 10);
206+
expect(checkRun.name, 'mighty_readme');
207+
expect(checkRun.conclusion, CheckRunConclusion.skipped);
208+
});
108209
});
109210
}

0 commit comments

Comments
 (0)