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 9f29d46

Browse filesBrowse files
committed
Fix for getting deployment by id.
Fixes hub4j#529.
1 parent efb87c5 commit 9f29d46
Copy full SHA for 9f29d46
Expand file treeCollapse file tree

8 files changed

+558
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRepository.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public PagedIterable<GHDeployment> listDeployments(String sha,String ref,String
129129
* Obtains a single {@link GHDeployment} by its ID.
130130
*/
131131
public GHDeployment getDeployment(long id) throws IOException {
132-
return root.retrieve().to("deployments/" + id, GHDeployment.class).wrap(this);
132+
return root.retrieve().to(getApiTailUrl("deployments/" + id), GHDeployment.class).wrap(this);
133133
}
134134

135135
private String join(List<String> params, String joinStr) {
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.kohsuke.github;
2+
3+
import org.junit.Test;
4+
5+
import java.io.IOException;
6+
import static org.junit.Assert.assertNotNull;
7+
8+
/**
9+
* @author Martin van Zijl
10+
*/
11+
public class GHDeploymentTest extends AbstractGitHubWireMockTest {
12+
13+
@Test
14+
public void testGetDeploymentById() throws IOException {
15+
GHRepository repo = getRepository();
16+
GHDeployment deployment = repo.getDeployment(178653229);
17+
assertNotNull(deployment);
18+
}
19+
20+
protected GHRepository getRepository() throws IOException {
21+
return getRepository(gitHub);
22+
}
23+
24+
private GHRepository getRepository(GitHub gitHub) throws IOException {
25+
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"login": "github-api-test-org",
3+
"id": 7544739,
4+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
5+
"url": "https://api.github.com/orgs/github-api-test-org",
6+
"repos_url": "https://api.github.com/orgs/github-api-test-org/repos",
7+
"events_url": "https://api.github.com/orgs/github-api-test-org/events",
8+
"hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks",
9+
"issues_url": "https://api.github.com/orgs/github-api-test-org/issues",
10+
"members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}",
11+
"public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}",
12+
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
13+
"description": null,
14+
"is_verified": false,
15+
"has_organization_projects": true,
16+
"has_repository_projects": true,
17+
"public_repos": 10,
18+
"public_gists": 0,
19+
"followers": 0,
20+
"following": 0,
21+
"html_url": "https://github.com/github-api-test-org",
22+
"created_at": "2014-05-10T19:39:11Z",
23+
"updated_at": "2015-04-20T00:42:30Z",
24+
"type": "Organization",
25+
"total_private_repos": 0,
26+
"owned_private_repos": 0,
27+
"private_gists": 0,
28+
"disk_usage": 132,
29+
"collaborators": 0,
30+
"billing_email": "kk@kohsuke.org",
31+
"default_repository_permission": "none",
32+
"members_can_create_repositories": false,
33+
"two_factor_requirement_enabled": false,
34+
"plan": {
35+
"name": "free",
36+
"space": 976562499,
37+
"private_repos": 0,
38+
"filled_seats": 7,
39+
"seats": 0
40+
}
41+
}

‎src/test/resources/org/kohsuke/github/GHDeploymentTest/wiremock/testGetDeploymentById/__files/repos_github-api-test-org_github-api-a1a9ff0a-2e37-4803-a9de-fb8fffd45f41.json

Copy file name to clipboardExpand all lines: src/test/resources/org/kohsuke/github/GHDeploymentTest/wiremock/testGetDeploymentById/__files/repos_github-api-test-org_github-api-a1a9ff0a-2e37-4803-a9de-fb8fffd45f41.json
+330Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"url": "https://api.github.com/repos/github-api-test-org/github-api/deployments/178653229",
3+
"id": 178653229,
4+
"node_id": "MDEwOkRlcGxveW1lbnQxNzg2NTMyMjk=",
5+
"sha": "3a09d2de4a9a1322a0ba2c3e2f54a919ca8fe353",
6+
"ref": "master",
7+
"task": "deploy",
8+
"payload": {},
9+
"original_environment": "production",
10+
"environment": "production",
11+
"description": null,
12+
"creator": {
13+
"login": "martinvanzijl",
14+
"id": 24422213,
15+
"node_id": "MDQ6VXNlcjI0NDIyMjEz",
16+
"avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4",
17+
"gravatar_id": "",
18+
"url": "https://api.github.com/users/martinvanzijl",
19+
"html_url": "https://github.com/martinvanzijl",
20+
"followers_url": "https://api.github.com/users/martinvanzijl/followers",
21+
"following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}",
22+
"gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}",
23+
"starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}",
24+
"subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions",
25+
"organizations_url": "https://api.github.com/users/martinvanzijl/orgs",
26+
"repos_url": "https://api.github.com/users/martinvanzijl/repos",
27+
"events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}",
28+
"received_events_url": "https://api.github.com/users/martinvanzijl/received_events",
29+
"type": "User",
30+
"site_admin": false
31+
},
32+
"created_at": "2019-10-30T00:03:34Z",
33+
"updated_at": "2019-10-30T00:03:34Z",
34+
"statuses_url": "https://api.github.com/repos/github-api-test-org/github-api/deployments/178653229/statuses",
35+
"repository_url": "https://api.github.com/repos/github-api-test-org/github-api"
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"id": "4def936c-47fd-43aa-851a-f9dd06f236b5",
3+
"name": "orgs_github-api-test-org",
4+
"request": {
5+
"url": "/orgs/github-api-test-org",
6+
"method": "GET"
7+
},
8+
"response": {
9+
"status": 200,
10+
"bodyFileName": "orgs_github-api-test-org-4def936c-47fd-43aa-851a-f9dd06f236b5.json",
11+
"headers": {
12+
"Date": "Wed, 30 Oct 2019 00:11:46 GMT",
13+
"Content-Type": "application/json; charset=utf-8",
14+
"Server": "GitHub.com",
15+
"Status": "200 OK",
16+
"X-RateLimit-Limit": "5000",
17+
"X-RateLimit-Remaining": "4980",
18+
"X-RateLimit-Reset": "1572397284",
19+
"Cache-Control": "private, max-age=60, s-maxage=60",
20+
"Vary": [
21+
"Accept, Authorization, Cookie, X-GitHub-OTP",
22+
"Accept-Encoding"
23+
],
24+
"ETag": "W/\"4342e0e7004c1a50986c767513fe857d\"",
25+
"Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT",
26+
"X-GitHub-Media-Type": "unknown, github.v3",
27+
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
28+
"Access-Control-Allow-Origin": "*",
29+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
30+
"X-Frame-Options": "deny",
31+
"X-Content-Type-Options": "nosniff",
32+
"X-XSS-Protection": "1; mode=block",
33+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
34+
"Content-Security-Policy": "default-src 'none'",
35+
"X-GitHub-Request-Id": "DFCA:4866:E50AD:103D70:5DB8D541"
36+
}
37+
},
38+
"uuid": "4def936c-47fd-43aa-851a-f9dd06f236b5",
39+
"persistent": true,
40+
"insertionIndex": 1
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"id": "a1a9ff0a-2e37-4803-a9de-fb8fffd45f41",
3+
"name": "repos_github-api-test-org_github-api",
4+
"request": {
5+
"url": "/repos/github-api-test-org/github-api",
6+
"method": "GET"
7+
},
8+
"response": {
9+
"status": 200,
10+
"bodyFileName": "repos_github-api-test-org_github-api-a1a9ff0a-2e37-4803-a9de-fb8fffd45f41.json",
11+
"headers": {
12+
"Date": "Wed, 30 Oct 2019 00:11:47 GMT",
13+
"Content-Type": "application/json; charset=utf-8",
14+
"Server": "GitHub.com",
15+
"Status": "200 OK",
16+
"X-RateLimit-Limit": "5000",
17+
"X-RateLimit-Remaining": "4979",
18+
"X-RateLimit-Reset": "1572397284",
19+
"Cache-Control": "private, max-age=60, s-maxage=60",
20+
"Vary": [
21+
"Accept, Authorization, Cookie, X-GitHub-OTP",
22+
"Accept-Encoding"
23+
],
24+
"ETag": "W/\"4ef7d9ee7bc7f4f32000eb0720da5bf1\"",
25+
"Last-Modified": "Mon, 30 Sep 2019 22:36:47 GMT",
26+
"X-GitHub-Media-Type": "unknown, github.v3",
27+
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
28+
"Access-Control-Allow-Origin": "*",
29+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
30+
"X-Frame-Options": "deny",
31+
"X-Content-Type-Options": "nosniff",
32+
"X-XSS-Protection": "1; mode=block",
33+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
34+
"Content-Security-Policy": "default-src 'none'",
35+
"X-GitHub-Request-Id": "DFCA:4866:E50D8:103D81:5DB8D542"
36+
}
37+
},
38+
"uuid": "a1a9ff0a-2e37-4803-a9de-fb8fffd45f41",
39+
"persistent": true,
40+
"insertionIndex": 2
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"id": "d1d9d992-25e4-4a4b-8710-5b0c57e99a64",
3+
"name": "repos_github-api-test-org_github-api_deployments_178653229",
4+
"request": {
5+
"url": "/repos/github-api-test-org/github-api/deployments/178653229",
6+
"method": "GET"
7+
},
8+
"response": {
9+
"status": 200,
10+
"bodyFileName": "repos_github-api-test-org_github-api_deployments_178653229-d1d9d992-25e4-4a4b-8710-5b0c57e99a64.json",
11+
"headers": {
12+
"Date": "Wed, 30 Oct 2019 00:11:48 GMT",
13+
"Content-Type": "application/json; charset=utf-8",
14+
"Server": "GitHub.com",
15+
"Status": "200 OK",
16+
"X-RateLimit-Limit": "5000",
17+
"X-RateLimit-Remaining": "4978",
18+
"X-RateLimit-Reset": "1572397284",
19+
"Cache-Control": "private, max-age=60, s-maxage=60",
20+
"Vary": [
21+
"Accept, Authorization, Cookie, X-GitHub-OTP",
22+
"Accept-Encoding"
23+
],
24+
"ETag": "W/\"e1b3c1f524645e959b25405131fba656\"",
25+
"Last-Modified": "Wed, 30 Oct 2019 00:03:34 GMT",
26+
"X-GitHub-Media-Type": "unknown, github.v3",
27+
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
28+
"Access-Control-Allow-Origin": "*",
29+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
30+
"X-Frame-Options": "deny",
31+
"X-Content-Type-Options": "nosniff",
32+
"X-XSS-Protection": "1; mode=block",
33+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
34+
"Content-Security-Policy": "default-src 'none'",
35+
"X-GitHub-Request-Id": "DFCA:4866:E50EA:103DAF:5DB8D543"
36+
}
37+
},
38+
"uuid": "d1d9d992-25e4-4a4b-8710-5b0c57e99a64",
39+
"persistent": true,
40+
"insertionIndex": 3
41+
}

0 commit comments

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