Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 329e29d

Browse filesBrowse files
committed
Use send() to execute requests instead of fetchHttpStatusCode()
Fixes hub4j#1380 Note: I had to take a new snapshot for GHWorkflowTest as the dispatch tests was silently failing before (we were using an input that was not declared in the workflow, I fixed that in the test workflow).
1 parent a8481fc commit 329e29d
Copy full SHA for 329e29d

File tree

Expand file treeCollapse file tree

55 files changed

+2552
-1325
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

55 files changed

+2552
-1325
lines changed

‎src/main/java/org/kohsuke/github/GHArtifact.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHArtifact.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public URL getHtmlUrl() throws IOException {
9999
* the io exception
100100
*/
101101
public void delete() throws IOException {
102-
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).fetchHttpStatusCode();
102+
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
103103
}
104104

105105
/**

‎src/main/java/org/kohsuke/github/GHWorkflow.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHWorkflow.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public URL getBadgeUrl() {
8787
* the io exception
8888
*/
8989
public void disable() throws IOException {
90-
root().createRequest().method("PUT").withUrlPath(getApiRoute(), "disable").fetchHttpStatusCode();
90+
root().createRequest().method("PUT").withUrlPath(getApiRoute(), "disable").send();
9191
}
9292

9393
/**
@@ -97,7 +97,7 @@ public void disable() throws IOException {
9797
* the io exception
9898
*/
9999
public void enable() throws IOException {
100-
root().createRequest().method("PUT").withUrlPath(getApiRoute(), "enable").fetchHttpStatusCode();
100+
root().createRequest().method("PUT").withUrlPath(getApiRoute(), "enable").send();
101101
}
102102

103103
/**
@@ -133,7 +133,7 @@ public void dispatch(String ref, Map<String, Object> inputs) throws IOException
133133
requester.with("inputs", inputs);
134134
}
135135

136-
requester.fetchHttpStatusCode();
136+
requester.send();
137137
}
138138

139139
/**

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHWorkflowRun.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public List<GHPullRequest> getPullRequests() throws IOException {
276276
* the io exception
277277
*/
278278
public void cancel() throws IOException {
279-
root().createRequest().method("POST").withUrlPath(getApiRoute(), "cancel").fetchHttpStatusCode();
279+
root().createRequest().method("POST").withUrlPath(getApiRoute(), "cancel").send();
280280
}
281281

282282
/**
@@ -286,7 +286,7 @@ public void cancel() throws IOException {
286286
* the io exception
287287
*/
288288
public void delete() throws IOException {
289-
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).fetchHttpStatusCode();
289+
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
290290
}
291291

292292
/**
@@ -296,7 +296,7 @@ public void delete() throws IOException {
296296
* the io exception
297297
*/
298298
public void rerun() throws IOException {
299-
root().createRequest().method("POST").withUrlPath(getApiRoute(), "rerun").fetchHttpStatusCode();
299+
root().createRequest().method("POST").withUrlPath(getApiRoute(), "rerun").send();
300300
}
301301

302302
/**
@@ -336,7 +336,7 @@ public <T> T downloadLogs(InputStreamFunction<T> streamFunction) throws IOExcept
336336
* the io exception
337337
*/
338338
public void deleteLogs() throws IOException {
339-
root().createRequest().method("DELETE").withUrlPath(getApiRoute(), "logs").fetchHttpStatusCode();
339+
root().createRequest().method("DELETE").withUrlPath(getApiRoute(), "logs").send();
340340
}
341341

342342
/**

‎src/main/java/org/kohsuke/github/Requester.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/Requester.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Requester extends GitHubRequest.Builder<Requester> {
5050
}
5151

5252
/**
53-
* Sends a request to the specified URL and checks that it is sucessful.
53+
* Sends a request to the specified URL and checks that it is successful.
5454
*
5555
* @throws IOException
5656
* the io exception

‎src/test/java/org/kohsuke/github/GHWorkflowTest.java

Copy file name to clipboardExpand all lines: src/test/java/org/kohsuke/github/GHWorkflowTest.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void testListWorkflowRuns() throws IOException {
115115
GHWorkflow workflow = repo.getWorkflow("test-workflow.yml");
116116

117117
List<GHWorkflowRun> workflowRuns = workflow.listRuns().toList();
118-
assertThat(workflowRuns.size(), is(2));
118+
assertThat(workflowRuns.size(), greaterThan(2));
119119

120120
checkWorkflowRunProperties(workflowRuns.get(0), workflow.getId());
121121
checkWorkflowRunProperties(workflowRuns.get(1), workflow.getId());
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/releases{/id}",
6666
"deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/deployments",
6767
"created_at": "2021-03-17T09:32:03Z",
68-
"updated_at": "2021-03-17T09:33:34Z",
69-
"pushed_at": "2021-03-17T09:33:32Z",
68+
"updated_at": "2022-05-12T12:41:19Z",
69+
"pushed_at": "2022-05-12T12:41:16Z",
7070
"git_url": "git://github.com/hub4j-test-org/GHWorkflowTest.git",
7171
"ssh_url": "git@github.com:hub4j-test-org/GHWorkflowTest.git",
7272
"clone_url": "https://github.com/hub4j-test-org/GHWorkflowTest.git",
@@ -87,20 +87,28 @@
8787
"disabled": false,
8888
"open_issues_count": 0,
8989
"license": null,
90+
"allow_forking": true,
91+
"is_template": false,
92+
"topics": [],
93+
"visibility": "public",
9094
"forks": 0,
9195
"open_issues": 0,
9296
"watchers": 0,
9397
"default_branch": "main",
9498
"permissions": {
9599
"admin": true,
100+
"maintain": true,
96101
"push": true,
102+
"triage": true,
97103
"pull": true
98104
},
99105
"temp_clone_token": "",
100106
"allow_squash_merge": true,
101107
"allow_merge_commit": true,
102108
"allow_rebase_merge": true,
109+
"allow_auto_merge": false,
103110
"delete_branch_on_merge": false,
111+
"allow_update_branch": false,
104112
"organization": {
105113
"login": "hub4j-test-org",
106114
"id": 7544739,
@@ -122,5 +130,5 @@
122130
"site_admin": false
123131
},
124132
"network_count": 0,
125-
"subscribers_count": 10
133+
"subscribers_count": 11
126134
}
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"path": ".github/workflows/test-workflow.yml",
66
"state": "active",
77
"created_at": "2021-03-17T10:33:32.000+01:00",
8-
"updated_at": "2021-03-22T14:55:53.000+01:00",
8+
"updated_at": "2022-05-12T14:43:11.000+02:00",
99
"url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859",
1010
"html_url": "https://github.com/hub4j-test-org/GHWorkflowTest/blob/main/.github/workflows/test-workflow.yml",
1111
"badge_url": "https://github.com/hub4j-test-org/GHWorkflowTest/workflows/test-workflow/badge.svg"
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"path": ".github/workflows/test-workflow.yml",
66
"state": "active",
77
"created_at": "2021-03-17T10:33:32.000+01:00",
8-
"updated_at": "2021-03-25T11:36:24.000+01:00",
8+
"updated_at": "2022-05-12T14:43:11.000+02:00",
99
"url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859",
1010
"html_url": "https://github.com/hub4j-test-org/GHWorkflowTest/blob/main/.github/workflows/test-workflow.yml",
1111
"badge_url": "https://github.com/hub4j-test-org/GHWorkflowTest/workflows/test-workflow/badge.svg"

‎src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testBasicInformation/__files/user-1.json

Copy file name to clipboardExpand all lines: src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testBasicInformation/__files/user-1.json
-46Lines changed: 0 additions & 46 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "1fbf864b-587b-4d30-8a65-43dfecc97028",
2+
"id": "220d20d4-be30-4b64-931a-832cea0fea16",
33
"name": "repos_hub4j-test-org_ghworkflowtest",
44
"request": {
55
"url": "/repos/hub4j-test-org/GHWorkflowTest",
@@ -12,35 +12,36 @@
1212
},
1313
"response": {
1414
"status": 200,
15-
"bodyFileName": "repos_hub4j-test-org_ghworkflowtest-2.json",
15+
"bodyFileName": "repos_hub4j-test-org_ghworkflowtest-1.json",
1616
"headers": {
1717
"Server": "GitHub.com",
18-
"Date": "Thu, 25 Mar 2021 10:36:28 GMT",
18+
"Date": "Thu, 12 May 2022 12:43:14 GMT",
1919
"Content-Type": "application/json; charset=utf-8",
2020
"Cache-Control": "private, max-age=60, s-maxage=60",
2121
"Vary": [
2222
"Accept, Authorization, Cookie, X-GitHub-OTP",
2323
"Accept-Encoding, Accept, X-Requested-With"
2424
],
25-
"ETag": "W/\"082e0c2ae9f1d8387e22ebe7279d627738b78d114a3badc2d9e60dfb0b2a6abf\"",
26-
"Last-Modified": "Wed, 17 Mar 2021 09:33:34 GMT",
27-
"X-OAuth-Scopes": "repo, user, workflow",
25+
"ETag": "W/\"b29404b8f46b810b45089727292ea01bec52720af73a92806b6826296fd3785b\"",
26+
"Last-Modified": "Thu, 12 May 2022 12:41:19 GMT",
27+
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion",
2828
"X-Accepted-OAuth-Scopes": "repo",
29-
"X-GitHub-Media-Type": "unknown, github.v3",
29+
"X-GitHub-Media-Type": "github.v3; format=json",
3030
"X-RateLimit-Limit": "5000",
31-
"X-RateLimit-Remaining": "4973",
32-
"X-RateLimit-Reset": "1616672182",
33-
"X-RateLimit-Used": "27",
31+
"X-RateLimit-Remaining": "4928",
32+
"X-RateLimit-Reset": "1652362924",
33+
"X-RateLimit-Used": "72",
34+
"X-RateLimit-Resource": "core",
3435
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
3536
"X-Frame-Options": "deny",
3637
"X-Content-Type-Options": "nosniff",
3738
"X-XSS-Protection": "0",
3839
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
3940
"Content-Security-Policy": "default-src 'none'",
40-
"X-GitHub-Request-Id": "D5A4:4AE4:1010430:10B0B4D:605C67AC"
41+
"X-GitHub-Request-Id": "C910:5519:542B692:555E102:627D00E2"
4142
}
4243
},
43-
"uuid": "1fbf864b-587b-4d30-8a65-43dfecc97028",
44+
"uuid": "220d20d4-be30-4b64-931a-832cea0fea16",
4445
"persistent": true,
45-
"insertionIndex": 2
46+
"insertionIndex": 1
4647
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "a37a5c44-61eb-4460-87e8-3207a15c7d2c",
2+
"id": "16128b7f-ff64-4091-85ab-5f0f6fd70dfb",
33
"name": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859",
44
"request": {
55
"url": "/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859",
@@ -12,34 +12,35 @@
1212
},
1313
"response": {
1414
"status": 200,
15-
"bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859-4.json",
15+
"bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859-3.json",
1616
"headers": {
1717
"Server": "GitHub.com",
18-
"Date": "Thu, 25 Mar 2021 10:36:29 GMT",
18+
"Date": "Thu, 12 May 2022 12:43:15 GMT",
1919
"Content-Type": "application/json; charset=utf-8",
2020
"Cache-Control": "private, max-age=60, s-maxage=60",
2121
"Vary": [
2222
"Accept, Authorization, Cookie, X-GitHub-OTP",
2323
"Accept-Encoding, Accept, X-Requested-With"
2424
],
25-
"ETag": "W/\"72a49555d2625ba9f490d619d324726f5192dc2a030dc22033b9cadf7a2ba076\"",
26-
"X-OAuth-Scopes": "repo, user, workflow",
25+
"ETag": "W/\"37311efa336094063a53d1313b6f73af8a2d5f81a7f10c95f7173189235ace0a\"",
26+
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion",
2727
"X-Accepted-OAuth-Scopes": "",
28-
"X-GitHub-Media-Type": "unknown, github.v3",
28+
"X-GitHub-Media-Type": "github.v3; format=json",
2929
"X-RateLimit-Limit": "5000",
30-
"X-RateLimit-Remaining": "4971",
31-
"X-RateLimit-Reset": "1616672182",
32-
"X-RateLimit-Used": "29",
30+
"X-RateLimit-Remaining": "4926",
31+
"X-RateLimit-Reset": "1652362924",
32+
"X-RateLimit-Used": "74",
33+
"X-RateLimit-Resource": "core",
3334
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
3435
"X-Frame-Options": "deny",
3536
"X-Content-Type-Options": "nosniff",
3637
"X-XSS-Protection": "0",
3738
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
3839
"Content-Security-Policy": "default-src 'none'",
39-
"X-GitHub-Request-Id": "D5A4:4AE4:1010476:10B0B89:605C67AC"
40+
"X-GitHub-Request-Id": "C914:90C1:253005B:25D30D4:627D00E3"
4041
}
4142
},
42-
"uuid": "a37a5c44-61eb-4460-87e8-3207a15c7d2c",
43+
"uuid": "16128b7f-ff64-4091-85ab-5f0f6fd70dfb",
4344
"persistent": true,
44-
"insertionIndex": 4
45+
"insertionIndex": 3
4546
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "1ca8cc16-7af0-40c3-832f-197e68817ac1",
2+
"id": "7618fd94-ee84-4b67-a401-45e1edfc38df",
33
"name": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml",
44
"request": {
55
"url": "/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/test-workflow.yml",
@@ -12,34 +12,35 @@
1212
},
1313
"response": {
1414
"status": 200,
15-
"bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json",
15+
"bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-2.json",
1616
"headers": {
1717
"Server": "GitHub.com",
18-
"Date": "Thu, 25 Mar 2021 10:36:28 GMT",
18+
"Date": "Thu, 12 May 2022 12:43:14 GMT",
1919
"Content-Type": "application/json; charset=utf-8",
2020
"Cache-Control": "private, max-age=60, s-maxage=60",
2121
"Vary": [
2222
"Accept, Authorization, Cookie, X-GitHub-OTP",
2323
"Accept-Encoding, Accept, X-Requested-With"
2424
],
25-
"ETag": "W/\"72a49555d2625ba9f490d619d324726f5192dc2a030dc22033b9cadf7a2ba076\"",
26-
"X-OAuth-Scopes": "repo, user, workflow",
25+
"ETag": "W/\"37311efa336094063a53d1313b6f73af8a2d5f81a7f10c95f7173189235ace0a\"",
26+
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion",
2727
"X-Accepted-OAuth-Scopes": "",
28-
"X-GitHub-Media-Type": "unknown, github.v3",
28+
"X-GitHub-Media-Type": "github.v3; format=json",
2929
"X-RateLimit-Limit": "5000",
30-
"X-RateLimit-Remaining": "4972",
31-
"X-RateLimit-Reset": "1616672182",
32-
"X-RateLimit-Used": "28",
30+
"X-RateLimit-Remaining": "4927",
31+
"X-RateLimit-Reset": "1652362924",
32+
"X-RateLimit-Used": "73",
33+
"X-RateLimit-Resource": "core",
3334
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
3435
"X-Frame-Options": "deny",
3536
"X-Content-Type-Options": "nosniff",
3637
"X-XSS-Protection": "0",
3738
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
3839
"Content-Security-Policy": "default-src 'none'",
39-
"X-GitHub-Request-Id": "D5A4:4AE4:101045A:10B0B77:605C67AC"
40+
"X-GitHub-Request-Id": "C912:90C0:19079B9:19965E8:627D00E2"
4041
}
4142
},
42-
"uuid": "1ca8cc16-7af0-40c3-832f-197e68817ac1",
43+
"uuid": "7618fd94-ee84-4b67-a401-45e1edfc38df",
4344
"persistent": true,
44-
"insertionIndex": 3
45+
"insertionIndex": 2
4546
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.