From 75918c59cc69dd08653bfbd13d8cb965f972f494 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Mon, 5 Feb 2018 14:30:24 -0800 Subject: [PATCH 01/27] Add GHRepository.getRelease and GHRepository.getReleaseByTagName These implement the API endpoints for: - GET /repos/:owner/:repo/releases/:id - GET /repos/:owner/:repo/releases/tags/:tag --- .../java/org/kohsuke/github/GHRepository.java | 16 ++++++++++ .../org/kohsuke/github/RepositoryTest.java | 30 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index b40f387b7f..6247e99138 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -310,6 +310,22 @@ public GHRef createRef(String name, String sha) throws IOException { public List getReleases() throws IOException { return listReleases().asList(); } + + public GHRelease getRelease(long id) throws IOException { + try { + return root.retrieve().to(getApiTailUrl("releases/" + id), GHRelease.class).wrap(this); + } catch (FileNotFoundException e) { + return null; // no release for this id + } + } + + public GHRelease getReleaseByTagName(String tag) throws IOException { + try { + return root.retrieve().to(getApiTailUrl("releases/tags/" + tag), GHRelease.class).wrap(this); + } catch (FileNotFoundException e) { + return null; // no release for this tag + } + } public GHRelease getLatestRelease() throws IOException { try { diff --git a/src/test/java/org/kohsuke/github/RepositoryTest.java b/src/test/java/org/kohsuke/github/RepositoryTest.java index 728f94a834..66fe689507 100644 --- a/src/test/java/org/kohsuke/github/RepositoryTest.java +++ b/src/test/java/org/kohsuke/github/RepositoryTest.java @@ -94,6 +94,36 @@ public void LatestRepositoryNotExist() { } } + @Test public void listReleases() throws IOException { + PagedIterable releases = gitHub.getOrganization("github").getRepository("hub").listReleases(); + assertTrue(releases.iterator().hasNext()); + } + + @Test + public void getReleaseExists() throws IOException { + GHRelease release = gitHub.getOrganization("github").getRepository("hub").getRelease(6839710); + assertEquals("v2.3.0-pre10", release.getTagName()); + } + + @Test + public void getReleaseDoesNotExist() throws IOException { + GHRelease release = gitHub.getOrganization("github").getRepository("hub").getRelease(Long.MAX_VALUE); + assertNull(release); + } + + @Test + public void getReleaseByTagNameExists() throws IOException { + GHRelease release = gitHub.getOrganization("github").getRepository("hub").getReleaseByTagName("v2.3.0-pre10"); + assertNotNull(release); + assertEquals("v2.3.0-pre10", release.getTagName()); + } + + @Test + public void getReleaseByTagNameDoesNotExist() throws IOException { + GHRelease release = getRepository().getReleaseByTagName("foo-bar-baz"); + assertNull(release); + } + private GHRepository getRepository() throws IOException { return gitHub.getOrganization("github-api-test-org").getRepository("jenkins"); } From 587438938ca077dfb4c510376e649c97988d703e Mon Sep 17 00:00:00 2001 From: Trevor Currie Date: Thu, 22 Feb 2018 09:38:25 -0800 Subject: [PATCH 02/27] Added release payload. --- .../org/kohsuke/github/GHEventPayload.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java index b01b32e432..6c72764f4b 100644 --- a/src/main/java/org/kohsuke/github/GHEventPayload.java +++ b/src/main/java/org/kohsuke/github/GHEventPayload.java @@ -716,6 +716,48 @@ public List getModified() { } } + /** + * A release was added to the repo + * + * @see authoritative source + */ + @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" }, + justification = "Constructed by JSON deserialization") + public static class Release extends GHEventPayload { + private String action; + private GHRelease release; + private GHRepository repository; + + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Comes from JSON deserialization") + public String getAction() { + return action; + } + + public GHRelease getRelease() { + return release; + } + + public void setRelease(GHRelease release) { + this.release = release; + } + + public GHRepository getRepository() { + return repository; + } + + public void setRepository(GHRepository repository) { + this.repository = repository; + } + + @Override + void wrapUp(GitHub root) { + super.wrapUp(root); + if (repository != null) { + repository.wrap(root); + } + } + } + /** * A repository was created, deleted, made public, or made private. * From d61697a152c4ca50e82a95c0bee04b61430ac358 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Tue, 1 May 2018 07:56:38 -0700 Subject: [PATCH 03/27] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5b11e2f88c..3f134bed94 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ github-api - 1.93 + 1.94-SNAPSHOT GitHub API for Java http://github-api.kohsuke.org/ GitHub API for Java @@ -16,7 +16,7 @@ scm:git:git@github.com/kohsuke/${project.artifactId}.git scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git http://${project.artifactId}.kohsuke.org/ - github-api-1.93 + HEAD From 1145941d11b03dabfea98a4cb0cff64e688df309 Mon Sep 17 00:00:00 2001 From: Jae Gangemi Date: Sun, 27 May 2018 15:33:58 -0600 Subject: [PATCH 04/27] - add support for signed commits - add support for required number of reviews --- .../java/org/kohsuke/github/GHBranch.java | 4 +- .../kohsuke/github/GHBranchProtection.java | 58 +++++++++++++++++++ .../github/GHBranchProtectionBuilder.java | 34 ++++++++--- .../java/org/kohsuke/github/Previews.java | 2 + .../github/GHBranchProtectionTest.java | 27 +++++++++ 5 files changed, 114 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index 1ce9c29ac4..dbedcb64aa 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -67,7 +67,7 @@ public URL getProtectionUrl() { @Preview @Deprecated public GHBranchProtection getProtection() throws IOException { - return root.retrieve().withPreview(LOKI).to(protection_url, GHBranchProtection.class); + return root.retrieve().withPreview(LOKI).to(protection_url, GHBranchProtection.class).wrap(this); } /** @@ -82,7 +82,7 @@ public String getSHA1() { */ @Preview @Deprecated public void disableProtection() throws IOException { - new Requester(root).method("DELETE").withPreview(LOKI).to(protection_url); + new Requester(root).method("DELETE").to(protection_url); } /** diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java index 7e43bd69cb..a73d5ae2c4 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtection.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java @@ -3,14 +3,21 @@ import com.fasterxml.jackson.annotation.JsonProperty; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import static org.kohsuke.github.Previews.ZZZAX; + +import java.io.IOException; import java.util.Collection; @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" }, justification = "JSON API") public class GHBranchProtection { + private static final String REQUIRE_SIGNATURES_URI = "/required_signatures"; + @JsonProperty("enforce_admins") private EnforceAdmins enforceAdmins; + private GitHub root; + @JsonProperty("required_pull_request_reviews") private RequiredReviews requiredReviews; @@ -23,6 +30,18 @@ public class GHBranchProtection { @JsonProperty private String url; + @Preview @Deprecated + public RequiredSignatures enabledSignedCommits() throws IOException { + return requester().method("POST") + .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class); + } + + @Preview @Deprecated + public void disableSignedCommits() throws IOException { + requester().method("DELETE") + .to(url + REQUIRE_SIGNATURES_URI); + } + public EnforceAdmins getEnforceAdmins() { return enforceAdmins; } @@ -31,6 +50,12 @@ public RequiredReviews getRequiredReviews() { return requiredReviews; } + @Preview @Deprecated + public RequiredSignatures getRequiredSignatures() throws IOException { + return requester().method("GET") + .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class); + } + public RequiredStatusChecks getRequiredStatusChecks() { return requiredStatusChecks; } @@ -43,6 +68,15 @@ public String getUrl() { return url; } + GHBranchProtection wrap(GHBranch branch) { + this.root = branch.getRoot(); + return this; + } + + private Requester requester() { + return new Requester(root).withPreview(ZZZAX); + } + public static class EnforceAdmins { @JsonProperty private boolean enabled; @@ -69,6 +103,9 @@ public static class RequiredReviews { @JsonProperty("require_code_owner_reviews") private boolean requireCodeOwnerReviews; + @JsonProperty("required_approving_review_count") + private int requiredReviewers; + @JsonProperty private String url; @@ -87,6 +124,27 @@ public boolean isDismissStaleReviews() { public boolean isRequireCodeOwnerReviews() { return requireCodeOwnerReviews; } + + public int getRequiredReviewers() + { + return requiredReviewers; + } + } + + public static class RequiredSignatures { + @JsonProperty + private boolean enabled; + + @JsonProperty + private String url; + + public String getUrl() { + return url; + } + + public boolean isEnabled() { + return enabled; + } } public static class RequiredStatusChecks { diff --git a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java index dc7dbd8845..61e9b70fea 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java @@ -44,7 +44,12 @@ public GHBranchProtectionBuilder addRequiredChecks(String... checks) { } public GHBranchProtectionBuilder dismissStaleReviews() { - getPrReviews().put("dismiss_stale_reviews", true); + dismissStaleReviews(true); + return this; + } + + public GHBranchProtectionBuilder dismissStaleReviews(boolean v) { + getPrReviews().put("dismiss_stale_reviews", v); return this; } @@ -54,7 +59,8 @@ public GHBranchProtection enable() throws IOException { .withNullable("required_pull_request_reviews", prReviews) .withNullable("restrictions", restrictions) .withNullable("enforce_admins", enforceAdmins) - .to(branch.getProtectionUrl().toString(), GHBranchProtection.class); + .to(branch.getProtectionUrl().toString(), GHBranchProtection.class) + .wrap(branch); } public GHBranchProtectionBuilder includeAdmins() { @@ -66,6 +72,11 @@ public GHBranchProtectionBuilder includeAdmins(boolean v) { return this; } + public GHBranchProtectionBuilder requiredReviewers(int v) { + getPrReviews().put("required_approving_review_count", v); + return this; + } + public GHBranchProtectionBuilder requireBranchIsUpToDate() { return requireBranchIsUpToDate(true); } @@ -89,6 +100,16 @@ public GHBranchProtectionBuilder requireReviews() { return this; } + public GHBranchProtectionBuilder restrictReviewDismissals() { + getPrReviews(); + + if (!prReviews.containsKey("dismissal_restrictions")) { + prReviews.put("dismissal_restrictions", new Restrictions()); + } + + return this; + } + public GHBranchProtectionBuilder restrictPushAccess() { getRestrictions(); return this; @@ -151,12 +172,7 @@ public GHBranchProtectionBuilder userReviewDismissals(GHUser... users) { } private void addReviewRestriction(String restriction, boolean isTeam) { - getPrReviews(); - - if (!prReviews.containsKey("dismissal_restrictions")) { - prReviews.put("dismissal_restrictions", new Restrictions()); - } - + restrictReviewDismissals(); Restrictions restrictions = (Restrictions) prReviews.get("dismissal_restrictions"); if (isTeam) { @@ -188,7 +204,7 @@ private StatusChecks getStatusChecks() { } private Requester requester() { - return new Requester(branch.getRoot()).withPreview(LOKI); + return new Requester(branch.getRoot()).withPreview(LUKE_CAGE); } private static class Restrictions { diff --git a/src/main/java/org/kohsuke/github/Previews.java b/src/main/java/org/kohsuke/github/Previews.java index 3f98c3d4b9..f1686e24aa 100644 --- a/src/main/java/org/kohsuke/github/Previews.java +++ b/src/main/java/org/kohsuke/github/Previews.java @@ -5,7 +5,9 @@ */ /*package*/ class Previews { static final String LOKI = "application/vnd.github.loki-preview+json"; + static final String LUKE_CAGE = "application/vnd.github.luke-cage-preview+json"; static final String DRAX = "application/vnd.github.drax-preview+json"; static final String SQUIRREL_GIRL = "application/vnd.github.squirrel-girl-preview"; static final String CLOAK = "application/vnd.github.cloak-preview"; + static final String ZZZAX = "application/vnd.github.zzzax-preview+json"; } diff --git a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java index b7ae713d87..a6b711b6c0 100644 --- a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java +++ b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import org.kohsuke.github.GHBranchProtection.EnforceAdmins; import org.kohsuke.github.GHBranchProtection.RequiredReviews; +import org.kohsuke.github.GHBranchProtection.RequiredSignatures; import org.kohsuke.github.GHBranchProtection.RequiredStatusChecks; import java.io.FileNotFoundException; @@ -32,6 +33,12 @@ public void setUp() throws Exception { branch = repo.getBranch(BRANCH); if (branch.isProtected()) { + GHBranchProtection protection = branch.getProtection(); + if (protection.getRequiredSignatures().isEnabled()) { + protection.disableSignedCommits(); + } + + assertFalse(protection.getRequiredSignatures().isEnabled()); branch.disableProtection(); } @@ -47,6 +54,7 @@ public void testEnableBranchProtections() throws Exception { .requireBranchIsUpToDate() .requireCodeOwnReviews() .dismissStaleReviews() + .requiredReviewers(2) .includeAdmins() .enable(); @@ -59,6 +67,7 @@ public void testEnableBranchProtections() throws Exception { assertNotNull(requiredReviews); assertTrue(requiredReviews.isDismissStaleReviews()); assertTrue(requiredReviews.isRequireCodeOwnerReviews()); + assertEquals(2, requiredReviews.getRequiredReviewers()); EnforceAdmins enforceAdmins = protection.getEnforceAdmins(); assertNotNull(enforceAdmins); @@ -79,4 +88,22 @@ public void testEnableRequireReviewsOnly() throws Exception { assertNotNull(protection.getRequiredReviews()); } + + @Test + public void testSignedCommits() throws Exception { + GHBranchProtection protection = branch.enableProtection().enable(); + + RequiredSignatures signatures = protection.getRequiredSignatures(); + assertNotNull(signatures); + assertFalse(signatures.isEnabled()); + + signatures = protection.enabledSignedCommits(); + assertNotNull(signatures); + assertTrue(signatures.isEnabled()); + + protection.disableSignedCommits(); + signatures = protection.getRequiredSignatures(); + assertNotNull(signatures); + assertFalse(signatures.isEnabled()); + } } From ca6d77cbb33893b3f6b7827a7966add69c45ea58 Mon Sep 17 00:00:00 2001 From: Jae Gangemi Date: Mon, 28 May 2018 17:49:21 -0600 Subject: [PATCH 05/27] - remove unthrown IOException --- src/main/java/org/kohsuke/github/GHOrganization.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index f174decf2f..3bf34e2c98 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -50,7 +50,7 @@ public GHRepository createRepository(String name, String description, String hom * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()} * to finally createa repository. */ - public GHCreateRepositoryBuilder createRepository(String name) throws IOException { + public GHCreateRepositoryBuilder createRepository(String name) { return new GHCreateRepositoryBuilder(root,"/orgs/"+login+"/repos",name); } From fe5ea52cdf9d2af3b434ac28428fab78270d7bdd Mon Sep 17 00:00:00 2001 From: Rechi Date: Tue, 29 May 2018 22:00:00 +0200 Subject: [PATCH 06/27] [feature] implement Repository Invitations API fixes #374 --- .../java/org/kohsuke/github/GHInvitation.java | 45 +++++++++++++++++++ .../java/org/kohsuke/github/GHRepository.java | 16 +++++++ src/main/java/org/kohsuke/github/GitHub.java | 9 ++++ 3 files changed, 70 insertions(+) create mode 100644 src/main/java/org/kohsuke/github/GHInvitation.java diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java new file mode 100644 index 0000000000..6c285fefd1 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHInvitation.java @@ -0,0 +1,45 @@ +package org.kohsuke.github; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +public class GHInvitation extends GHObject { + /*package almost final*/ GitHub root; + + private int id; + private GHRepository repository; + private GHUser invitee, inviter; + private String permissions; + private String html_url; + + /*package*/ GHInvitation wrapUp(GitHub root) { + this.root = root; + return this; + } + + /** + * Accept a repository invitation. + */ + public void accept() throws IOException { + root.retrieve().method("PATCH").to("/user/repository_invitations/" + id); + } + + /** + * Decline a repository invitation. + */ + public void decline() throws IOException { + root.retrieve().method("DELETE").to("/user/repository_invitations/" + id); + } + + @Override + public URL getHtmlUrl() { + return GitHub.parseURL(html_url); + } +} diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 3c80c499ff..d72cba14d3 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1137,6 +1137,22 @@ public GHLabel createLabel(String name, String color) throws IOException { .to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this); } + /** + * Lists all the invitations. + */ + public PagedIterable listInvitations() { + return new PagedIterable() { + public PagedIterator _iterator(int pageSize) { + return new PagedIterator(root.retrieve().asIterator(String.format("/repos/%s/%s/invitations", getOwnerName(), name), GHInvitation[].class, pageSize)) { + protected void wrapUp(GHInvitation[] page) { + for (GHInvitation c : page) + c.wrapUp(root); + } + }; + } + }; + } + /** * Lists all the subscribers (aka watchers.) * diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index 52a16906da..d5d0a2be33 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -530,6 +530,15 @@ public GHLicense getLicense(String key) throws IOException { } /** + * Gets complete list of open invitations for current user. + */ + public List getMyInvitations() throws IOException { + GHInvitation[] invitations = retrieve().to("/user/repository_invitations", GHInvitation[].class); + for (GHInvitation i : invitations) { + i.wrapUp(this); + } + return Arrays.asList(invitations); + } /** * This method returns a shallowly populated organizations. From eacdd7afe8cf25c9cd0e4ba97f914cd6e9a45800 Mon Sep 17 00:00:00 2001 From: Jae Gangemi Date: Wed, 30 May 2018 08:18:25 -0600 Subject: [PATCH 07/27] - added overloaded 'uploadAsset' method --- src/main/java/org/kohsuke/github/GHRelease.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHRelease.java b/src/main/java/org/kohsuke/github/GHRelease.java index a299add2c5..d49c0a2890 100644 --- a/src/main/java/org/kohsuke/github/GHRelease.java +++ b/src/main/java/org/kohsuke/github/GHRelease.java @@ -3,6 +3,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.util.Arrays; import java.util.Date; @@ -125,12 +126,16 @@ static GHRelease[] wrap(GHRelease[] releases, GHRepository owner) { * handling of the HTTP requests to github's API. */ public GHAsset uploadAsset(File file, String contentType) throws IOException { + return uploadAsset(file.getName(), new FileInputStream(file), contentType); + } + + public GHAsset uploadAsset(String filename, InputStream stream, String contentType) throws IOException { Requester builder = new Requester(owner.root); String url = format("https://uploads.github.com%s/releases/%d/assets?name=%s", - owner.getApiTailUrl(""), getId(), file.getName()); + owner.getApiTailUrl(""), getId(), filename); return builder.contentType(contentType) - .with(new FileInputStream(file)) + .with(stream) .to(url, GHAsset.class).wrap(this); } From fd37a2c46605ff02cccf31731cc668037c66e7e4 Mon Sep 17 00:00:00 2001 From: l3ender Date: Wed, 6 Jun 2018 11:44:46 -0500 Subject: [PATCH 08/27] Add support for repository searching by "topic" See https://help.github.com/articles/searching-repositories/#search-by-topic --- .../java/org/kohsuke/github/GHRepositorySearchBuilder.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHRepositorySearchBuilder.java b/src/main/java/org/kohsuke/github/GHRepositorySearchBuilder.java index 642f7f3d95..0ecd77e600 100644 --- a/src/main/java/org/kohsuke/github/GHRepositorySearchBuilder.java +++ b/src/main/java/org/kohsuke/github/GHRepositorySearchBuilder.java @@ -55,6 +55,10 @@ public GHRepositorySearchBuilder stars(String v) { return q("stars:"+v); } + public GHRepositorySearchBuilder topic(String v) { + return q("topic:"+v); + } + public GHRepositorySearchBuilder order(GHDirection v) { req.with("order",v); return this; From 943f47d29d86689fda92446e3f64527468d40af1 Mon Sep 17 00:00:00 2001 From: Oliver Noguera Date: Thu, 15 Mar 2018 18:39:32 +0100 Subject: [PATCH 09/27] Add sha1 to updateFiles see https://developer.github.com/v3/repos/contents/#update-a-file --- .../java/org/kohsuke/github/GHRepository.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 3c80c499ff..869d11c54f 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1394,27 +1394,29 @@ public GHContent getReadme() throws IOException { return requester.to(getApiTailUrl("readme"), GHContent.class).wrap(this); } - public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException { - return createContent(content, commitMessage, path, null); + public GHContentUpdateResponse createContent(String content, String commitMessage, String path,String sha1) throws IOException { + return createContent(content, commitMessage, path, null,sha1); } - public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException { + public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch, String sha1) throws IOException { final byte[] payload; try { payload = content.getBytes("UTF-8"); } catch (UnsupportedEncodingException ex) { throw (IOException) new IOException("UTF-8 encoding is not supported").initCause(ex); } - return createContent(payload, commitMessage, path, branch); + return createContent(payload, commitMessage, path, branch,sha1); } - public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException { - return createContent(contentBytes, commitMessage, path, null); + public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path,String sha1) throws IOException { + return createContent(contentBytes, commitMessage, path, null,sha1); } - public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException { + public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch, + String sha1) throws IOException { Requester requester = new Requester(root) .with("path", path) + .with("sha", sha1) .with("message", commitMessage) .with("content", Base64.encodeBase64String(contentBytes)) .method("PUT"); From f68a85056ed52b26eb9c09207649c34a5a1fffb4 Mon Sep 17 00:00:00 2001 From: onoguera-ob Date: Thu, 15 Mar 2018 18:57:41 +0100 Subject: [PATCH 10/27] Update integration test. --- .../java/org/kohsuke/github/GHContentIntegrationTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java index 8e3873708b..b1ab9387f7 100644 --- a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java +++ b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java @@ -53,7 +53,10 @@ public void testGetDirectoryContentTrailingSlash() throws Exception { @Test public void testCRUDContent() throws Exception { - GHContentUpdateResponse created = repo.createContent("this is an awesome file I created\n", "Creating a file for integration tests.", createdFilename); + ; + GHContentUpdateResponse created = + repo.createContent("this is an awesome file I created\n", "Creating a file for integration tests.", createdFilename, + repo.getFileContent(createdFilename).getSha()); GHContent createdContent = created.getContent(); assertNotNull(created.getCommit()); From 2fcfb2f67df5075989d46c8a37daa6601321e06e Mon Sep 17 00:00:00 2001 From: Sharath Date: Tue, 12 Jun 2018 18:20:47 -0700 Subject: [PATCH 11/27] address review comments in supporting updating content with sha --- .../github/GHContentUpdateRequest.java | 97 +++++++++++++++++++ .../java/org/kohsuke/github/GHRepository.java | 53 +++++++--- .../org/kohsuke/github/PullRequestTest.java | 23 +++++ 3 files changed, 160 insertions(+), 13 deletions(-) create mode 100644 src/main/java/org/kohsuke/github/GHContentUpdateRequest.java diff --git a/src/main/java/org/kohsuke/github/GHContentUpdateRequest.java b/src/main/java/org/kohsuke/github/GHContentUpdateRequest.java new file mode 100644 index 0000000000..80bd0f6aa2 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHContentUpdateRequest.java @@ -0,0 +1,97 @@ +package org.kohsuke.github; + +public class GHContentUpdateRequest { + private final String path; + private final String branch; + private final String sha; + private final byte[] content; + private final String commitMessage; + + public static GHContentUpdateRequest.Builder getBuilder() { + return new GHContentUpdateRequest.Builder(); + } + + public GHContentUpdateRequest(String path, String branch, String sha, byte[] content, String commitMessage) { + this.path = path; + this.branch = branch; + this.sha = sha; + this.content = content; + this.commitMessage = commitMessage; + } + + private GHContentUpdateRequest(Builder builder) { + this.path = builder.path; + this.branch = builder.branch; + this.sha = builder.sha; + this.content = builder.content; + this.commitMessage = builder.commitMessage; + } + + public static Builder newGHContentUpdateRequest() { + return new Builder(); + } + + public String getPath() { + return path; + } + + public String getBranch() { + return branch; + } + + public String getSha() { + return sha; + } + + public byte[] getContent() { + return content; + } + + public String getCommitMessage() { + return commitMessage; + } + + public static final class Builder { + private String path; + private String branch; + private String sha; + private byte[] content; + private String commitMessage; + + private Builder() { + } + + public GHContentUpdateRequest build() { + return new GHContentUpdateRequest(this); + } + + public Builder path(String path) { + this.path = path; + return this; + } + + public Builder branch(String branch) { + this.branch = branch; + return this; + } + + public Builder sha(String sha) { + this.sha = sha; + return this; + } + + public Builder content(byte[] content) { + this.content = content; + return this; + } + public Builder content(String content) { + this.content = content.getBytes(); + return this; + } + + public Builder commitMessage(String commitMessage) { + this.commitMessage = commitMessage; + return this; + } + } +} diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 869d11c54f..302903ae8d 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1394,32 +1394,59 @@ public GHContent getReadme() throws IOException { return requester.to(getApiTailUrl("readme"), GHContent.class).wrap(this); } - public GHContentUpdateResponse createContent(String content, String commitMessage, String path,String sha1) throws IOException { - return createContent(content, commitMessage, path, null,sha1); + public GHContentUpdateResponse createContent(GHContentUpdateRequest updateRequest) throws IOException { + return createContent(updateRequest.getContent(), updateRequest.getCommitMessage(), updateRequest.getPath(), updateRequest.getBranch(), updateRequest.getSha()); } - public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch, String sha1) throws IOException { + /** + * Use {@link GHContentUpdateRequest}. + */ + @Deprecated + public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException { + return createContent(content.getBytes(), commitMessage, path, null, null); + } + + /** + * Use {@link GHContentUpdateRequest}. + */ + @Deprecated + public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException { final byte[] payload; try { payload = content.getBytes("UTF-8"); } catch (UnsupportedEncodingException ex) { throw (IOException) new IOException("UTF-8 encoding is not supported").initCause(ex); } - return createContent(payload, commitMessage, path, branch,sha1); + return createContent(payload, commitMessage, path, branch, null); } - public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path,String sha1) throws IOException { - return createContent(contentBytes, commitMessage, path, null,sha1); + /** + * Use {@link GHContentUpdateRequest}. + */ + @Deprecated + public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException { + return createContent(contentBytes, commitMessage, path, null, null); } - public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch, - String sha1) throws IOException { + /** + * Use {@link GHContentUpdateRequest}. + */ + @Deprecated + public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException { + return createContent(contentBytes, commitMessage, path, branch, null); + } + + private GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch, String sha1) throws IOException { Requester requester = new Requester(root) - .with("path", path) - .with("sha", sha1) - .with("message", commitMessage) - .with("content", Base64.encodeBase64String(contentBytes)) - .method("PUT"); + .with("path", path) + .with("message", commitMessage) + .with("content", Base64.encodeBase64String(contentBytes)) + .method("PUT"); + + if (sha1 != null) { + requester.with("sha", sha1); + } + if (branch != null) { requester.with("branch", branch); diff --git a/src/test/java/org/kohsuke/github/PullRequestTest.java b/src/test/java/org/kohsuke/github/PullRequestTest.java index c2a6a2705e..8bbada55bf 100644 --- a/src/test/java/org/kohsuke/github/PullRequestTest.java +++ b/src/test/java/org/kohsuke/github/PullRequestTest.java @@ -105,6 +105,7 @@ public void testSquashMerge() throws Exception { String name = rnd.next(); GHRef masterRef = getRepository().getRef("heads/master"); GHRef branchRef = getRepository().createRef("refs/heads/" + name, masterRef.getObject().getSha()); + getRepository().createContent(name, name, name, name); Thread.sleep(1000); GHPullRequest p = getRepository().createPullRequest(name, name, "master", "## test squash"); @@ -112,6 +113,28 @@ public void testSquashMerge() throws Exception { p.merge("squash merge", null, GHPullRequest.MergeMethod.SQUASH); branchRef.delete(); } + @Test + public void testUpdateContentSquashMerge() throws Exception { + String name = rnd.next(); + GHRef masterRef = getRepository().getRef("heads/master"); + GHRef branchRef = getRepository().createRef("refs/heads/" + name, masterRef.getObject().getSha()); + + GHContentUpdateResponse response = getRepository().createContent(name, name, name, name); + Thread.sleep(1000); + + GHContentUpdateRequest updateRequest = GHContentUpdateRequest.getBuilder() + .content(name + name) + .path(name) + .branch(name) + .commitMessage(name) + .sha(response.getContent().getSha()) + .build(); + getRepository().createContent(updateRequest); + GHPullRequest p = getRepository().createPullRequest(name, name, "master", "## test squash"); + Thread.sleep(1000); + p.merge("squash merge", null, GHPullRequest.MergeMethod.SQUASH); + branchRef.delete(); + } @Test // Requires push access to the test repo to pass From e368a17420e8c7e29f154d6558755cdfe977b5b7 Mon Sep 17 00:00:00 2001 From: Werner <1331699+Arrow768@users.noreply.github.com> Date: Sun, 1 Jul 2018 12:23:13 +0200 Subject: [PATCH 12/27] Adds the GHEventPayload.Issue class --- .../org/kohsuke/github/GHEventPayload.java | 45 +++++++++++++++++++ .../kohsuke/github/GHEventPayloadTest.java | 16 +++++-- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java index b01b32e432..28c33b940c 100644 --- a/src/main/java/org/kohsuke/github/GHEventPayload.java +++ b/src/main/java/org/kohsuke/github/GHEventPayload.java @@ -174,6 +174,51 @@ void wrapUp(GitHub root) { } } + /** + * A Issue has been assigned, unassigned, labeled, unlabeled, opened, edited, milestoned, demilestoned, closed, or reopened. + * + * @see authoritative source + */ + @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" }, + justification = "Constructed by JSON deserialization") + public static class Issue extends GHEventPayload { + private String action; + private GHIssue issue; + private GHRepository repository; + + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Comes from JSON deserialization") + public String getAction() { + return action; + } + + public GHIssue getIssue() { + return issue; + } + + public void setIssue(GHIssue issue) { + this.issue = issue; + } + + public GHRepository getRepository() { + return repository; + } + + public void setRepository(GHRepository repository) { + this.repository = repository; + } + + @Override + void wrapUp(GitHub root) { + super.wrapUp(root); + if (repository != null) { + repository.wrap(root); + issue.wrap(repository); + } else { + issue.wrap(root); + } + } + } + /** * A comment was added to an issue * diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java index 71f9fd3e68..b0c2a05408 100644 --- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java +++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java @@ -120,9 +120,19 @@ public void issue_comment() throws Exception { assertThat(event.getSender().getLogin(), is("baxterthehacker")); } -// TODO implement support classes and write test -// @Test -// public void issues() throws Exception {} + @Test + public void issues() throws Exception { + GHEventPayload.Issue event = GitHub.offline().parseEventPayload(payload.asReader(),GHEventPayload.Issue.class); + assertThat(event.getAction(),is("opened")); + assertThat(event.getIssue().getNumber(), is(2)); + assertThat(event.getIssue().getTitle(), is("Spelling error in the README file")); + assertThat(event.getIssue().getState(), is(GHIssueState.OPEN)); + assertThat(event.getIssue().getLabels().size(), is(1)); + assertThat(event.getIssue().getLabels().iterator().next().getName(), is("bug")); + assertThat(event.getRepository().getName(), is("public-repo")); + assertThat(event.getRepository().getOwner().getLogin(), is("baxterthehacker")); + assertThat(event.getSender().getLogin(), is("baxterthehacker")); + } // TODO implement support classes and write test // @Test From 0ffcbdbd38c786994029d0d0f93870da3ad12b15 Mon Sep 17 00:00:00 2001 From: Daniel Beck Date: Tue, 17 Jul 2018 11:27:54 +0200 Subject: [PATCH 13/27] Fix pagination for APIs that supported it ad hoc --- src/main/java/org/kohsuke/github/GHOrganization.java | 4 ++-- src/main/java/org/kohsuke/github/GHPerson.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index f174decf2f..d05e441223 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -269,7 +269,7 @@ protected void wrapUp(GHEventInfo[] page) { public PagedIterable listRepositories(final int pageSize) { return new PagedIterable() { public PagedIterator _iterator(int pageSize) { - return new PagedIterator(root.retrieve().asIterator("/orgs/" + login + "/repos?per_page=" + pageSize, GHRepository[].class, pageSize)) { + return new PagedIterator(root.retrieve().asIterator("/orgs/" + login + "/repos", GHRepository[].class, pageSize)) { @Override protected void wrapUp(GHRepository[] page) { for (GHRepository c : page) @@ -277,7 +277,7 @@ protected void wrapUp(GHRepository[] page) { } }; } - }; + }.withPageSize(pageSize); } /** diff --git a/src/main/java/org/kohsuke/github/GHPerson.java b/src/main/java/org/kohsuke/github/GHPerson.java index 87cb8efaa7..b1be225965 100644 --- a/src/main/java/org/kohsuke/github/GHPerson.java +++ b/src/main/java/org/kohsuke/github/GHPerson.java @@ -81,7 +81,7 @@ public PagedIterable listRepositories() { public PagedIterable listRepositories(final int pageSize) { return new PagedIterable() { public PagedIterator _iterator(int pageSize) { - return new PagedIterator(root.retrieve().asIterator("/users/" + login + "/repos?per_page=" + pageSize, GHRepository[].class, pageSize)) { + return new PagedIterator(root.retrieve().asIterator("/users/" + login + "/repos", GHRepository[].class, pageSize)) { @Override protected void wrapUp(GHRepository[] page) { for (GHRepository c : page) @@ -89,7 +89,7 @@ protected void wrapUp(GHRepository[] page) { } }; } - }; + }.withPageSize(pageSize); } /** @@ -108,7 +108,7 @@ protected void wrapUp(GHRepository[] page) { public synchronized Iterable> iterateRepositories(final int pageSize) { return new Iterable>() { public Iterator> iterator() { - final Iterator pager = root.retrieve().asIterator("/users/" + login + "/repos?per_page="+pageSize,GHRepository[].class, pageSize); + final Iterator pager = root.retrieve().asIterator("/users/" + login + "/repos",GHRepository[].class, pageSize); return new Iterator>() { public boolean hasNext() { From c309c2cf1365ceb9d81c0d80fbd105322d07a1a8 Mon Sep 17 00:00:00 2001 From: Martin van Zijl Date: Thu, 9 Aug 2018 14:17:44 +1200 Subject: [PATCH 14/27] Fix for issue #426. Fix null pointer when deleting refs. --- src/main/java/org/kohsuke/github/GHRepository.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 3c80c499ff..cc0dc27717 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -815,7 +815,9 @@ public PagedIterable listRefs() throws IOException { public PagedIterator _iterator(int pageSize) { return new PagedIterator(root.retrieve().asIterator(url, GHRef[].class, pageSize)) { protected void wrapUp(GHRef[] page) { - // no-op + for(GHRef p: page) { + p.wrap(root); + } } }; } From b2b7dfaf379860e2bdf8313ad752f4c5d4825ef8 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 19:05:19 -0700 Subject: [PATCH 15/27] Massaged the change to match the existing API design convention --- .../org/kohsuke/github/GHContentBuilder.java | 73 ++++++++++++++ .../github/GHContentUpdateRequest.java | 97 ------------------- .../java/org/kohsuke/github/GHRepository.java | 55 +++-------- .../org/kohsuke/github/PullRequestTest.java | 7 +- 4 files changed, 89 insertions(+), 143 deletions(-) create mode 100644 src/main/java/org/kohsuke/github/GHContentBuilder.java delete mode 100644 src/main/java/org/kohsuke/github/GHContentUpdateRequest.java diff --git a/src/main/java/org/kohsuke/github/GHContentBuilder.java b/src/main/java/org/kohsuke/github/GHContentBuilder.java new file mode 100644 index 0000000000..bd4a80c3af --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHContentBuilder.java @@ -0,0 +1,73 @@ +package org.kohsuke.github; + +import org.apache.commons.codec.binary.Base64; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +/** + * Used to create/update content. + * + * @author Kohsuke Kawaguchi + * @see GHRepository#createContent() + */ +public final class GHContentBuilder { + private final GHRepository repo; + private final Requester req; + private String path; + + GHContentBuilder(GHRepository repo) { + this.repo = repo; + this.req = new Requester(repo.root).method("PUT"); + } + + public GHContentBuilder path(String path) { + this.path = path; + req.with("path",path); + return this; + } + + public GHContentBuilder branch(String branch) { + req.with("branch", branch); + return this; + } + + /** + * Used when updating (but not creating a new content) to specify + * Thetblob SHA of the file being replaced. + */ + public GHContentBuilder sha(String sha) { + req.with("sha", sha); + return this; + } + + public GHContentBuilder content(byte[] content) { + req.with("content", Base64.encodeBase64String(content)); + return this; + } + + public GHContentBuilder content(String content) { + try { + return content(content.getBytes("UTF-8")); + } catch (UnsupportedEncodingException x) { + throw new AssertionError(); + } + } + + public GHContentBuilder message(String commitMessage) { + req.with("message", commitMessage); + return this; + } + + /** + * Commits a new content. + */ + public GHContentUpdateResponse commit() throws IOException { + GHContentUpdateResponse response = req.to(repo.getApiTailUrl("contents/" + path), GHContentUpdateResponse.class); + + response.getContent().wrap(repo); + response.getCommit().wrapUp(repo); + + return response; + } +} diff --git a/src/main/java/org/kohsuke/github/GHContentUpdateRequest.java b/src/main/java/org/kohsuke/github/GHContentUpdateRequest.java deleted file mode 100644 index 80bd0f6aa2..0000000000 --- a/src/main/java/org/kohsuke/github/GHContentUpdateRequest.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.kohsuke.github; - -public class GHContentUpdateRequest { - private final String path; - private final String branch; - private final String sha; - private final byte[] content; - private final String commitMessage; - - public static GHContentUpdateRequest.Builder getBuilder() { - return new GHContentUpdateRequest.Builder(); - } - - public GHContentUpdateRequest(String path, String branch, String sha, byte[] content, String commitMessage) { - this.path = path; - this.branch = branch; - this.sha = sha; - this.content = content; - this.commitMessage = commitMessage; - } - - private GHContentUpdateRequest(Builder builder) { - this.path = builder.path; - this.branch = builder.branch; - this.sha = builder.sha; - this.content = builder.content; - this.commitMessage = builder.commitMessage; - } - - public static Builder newGHContentUpdateRequest() { - return new Builder(); - } - - public String getPath() { - return path; - } - - public String getBranch() { - return branch; - } - - public String getSha() { - return sha; - } - - public byte[] getContent() { - return content; - } - - public String getCommitMessage() { - return commitMessage; - } - - public static final class Builder { - private String path; - private String branch; - private String sha; - private byte[] content; - private String commitMessage; - - private Builder() { - } - - public GHContentUpdateRequest build() { - return new GHContentUpdateRequest(this); - } - - public Builder path(String path) { - this.path = path; - return this; - } - - public Builder branch(String branch) { - this.branch = branch; - return this; - } - - public Builder sha(String sha) { - this.sha = sha; - return this; - } - - public Builder content(byte[] content) { - this.content = content; - return this; - } - public Builder content(String content) { - this.content = content.getBytes(); - return this; - } - - public Builder commitMessage(String commitMessage) { - this.commitMessage = commitMessage; - return this; - } - } -} diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 302903ae8d..66688a1a6b 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import java.io.FileNotFoundException; @@ -35,7 +34,6 @@ import java.io.InputStreamReader; import java.io.InterruptedIOException; import java.io.Reader; -import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.AbstractSet; import java.util.ArrayList; @@ -1394,70 +1392,43 @@ public GHContent getReadme() throws IOException { return requester.to(getApiTailUrl("readme"), GHContent.class).wrap(this); } - public GHContentUpdateResponse createContent(GHContentUpdateRequest updateRequest) throws IOException { - return createContent(updateRequest.getContent(), updateRequest.getCommitMessage(), updateRequest.getPath(), updateRequest.getBranch(), updateRequest.getSha()); + /** + * Creates a new content, or update an existing content. + */ + public GHContentBuilder createContent() { + return new GHContentBuilder(this); } /** - * Use {@link GHContentUpdateRequest}. + * Use {@link #createContent()}. */ @Deprecated public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException { - return createContent(content.getBytes(), commitMessage, path, null, null); + return createContent().content(content).message(commitMessage).path(path).commit(); } /** - * Use {@link GHContentUpdateRequest}. + * Use {@link #createContent()}. */ @Deprecated public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException { - final byte[] payload; - try { - payload = content.getBytes("UTF-8"); - } catch (UnsupportedEncodingException ex) { - throw (IOException) new IOException("UTF-8 encoding is not supported").initCause(ex); - } - return createContent(payload, commitMessage, path, branch, null); + return createContent().content(content).message(commitMessage).path(path).branch(branch).commit(); } /** - * Use {@link GHContentUpdateRequest}. + * Use {@link #createContent()}. */ @Deprecated public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException { - return createContent(contentBytes, commitMessage, path, null, null); + return createContent().content(contentBytes).message(commitMessage).path(path).commit(); } /** - * Use {@link GHContentUpdateRequest}. + * Use {@link #createContent()}. */ @Deprecated public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException { - return createContent(contentBytes, commitMessage, path, branch, null); - } - - private GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch, String sha1) throws IOException { - Requester requester = new Requester(root) - .with("path", path) - .with("message", commitMessage) - .with("content", Base64.encodeBase64String(contentBytes)) - .method("PUT"); - - if (sha1 != null) { - requester.with("sha", sha1); - } - - - if (branch != null) { - requester.with("branch", branch); - } - - GHContentUpdateResponse response = requester.to(getApiTailUrl("contents/" + path), GHContentUpdateResponse.class); - - response.getContent().wrap(this); - response.getCommit().wrapUp(this); - - return response; + return createContent().content(contentBytes).message(commitMessage).path(path).branch(branch).commit(); } public GHMilestone createMilestone(String title, String description) throws IOException { diff --git a/src/test/java/org/kohsuke/github/PullRequestTest.java b/src/test/java/org/kohsuke/github/PullRequestTest.java index 8bbada55bf..ceb741bd34 100644 --- a/src/test/java/org/kohsuke/github/PullRequestTest.java +++ b/src/test/java/org/kohsuke/github/PullRequestTest.java @@ -122,14 +122,13 @@ public void testUpdateContentSquashMerge() throws Exception { GHContentUpdateResponse response = getRepository().createContent(name, name, name, name); Thread.sleep(1000); - GHContentUpdateRequest updateRequest = GHContentUpdateRequest.getBuilder() + getRepository().createContent() .content(name + name) .path(name) .branch(name) - .commitMessage(name) + .message(name) .sha(response.getContent().getSha()) - .build(); - getRepository().createContent(updateRequest); + .commit(); GHPullRequest p = getRepository().createPullRequest(name, name, "master", "## test squash"); Thread.sleep(1000); p.merge("squash merge", null, GHPullRequest.MergeMethod.SQUASH); From 3fa70ac8411152a21f9fd286fbf68254e0964514 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 19:05:46 -0700 Subject: [PATCH 16/27] doc improvement --- src/main/java/org/kohsuke/github/GHContentBuilder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHContentBuilder.java b/src/main/java/org/kohsuke/github/GHContentBuilder.java index bd4a80c3af..cdc019f6d1 100644 --- a/src/main/java/org/kohsuke/github/GHContentBuilder.java +++ b/src/main/java/org/kohsuke/github/GHContentBuilder.java @@ -8,6 +8,9 @@ /** * Used to create/update content. * + *

+ * Call various methods to build up parameters, then call {@link #commit()} to make the change effective. + * * @author Kohsuke Kawaguchi * @see GHRepository#createContent() */ From ddc27e818b28b04b50d892c6683d111fbdc71056 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:09:11 -0700 Subject: [PATCH 17/27] Let's not yet expose this new class because it's not final --- .../org/kohsuke/github/GHBranchProtection.java | 10 +++++----- .../kohsuke/github/GHBranchProtectionTest.java | 18 ++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java index a73d5ae2c4..423576fc1d 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtection.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java @@ -31,8 +31,8 @@ public class GHBranchProtection { private String url; @Preview @Deprecated - public RequiredSignatures enabledSignedCommits() throws IOException { - return requester().method("POST") + public void enabledSignedCommits() throws IOException { + requester().method("POST") .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class); } @@ -51,9 +51,9 @@ public RequiredReviews getRequiredReviews() { } @Preview @Deprecated - public RequiredSignatures getRequiredSignatures() throws IOException { + public boolean getRequiredSignatures() throws IOException { return requester().method("GET") - .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class); + .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class).enabled; } public RequiredStatusChecks getRequiredStatusChecks() { @@ -131,7 +131,7 @@ public int getRequiredReviewers() } } - public static class RequiredSignatures { + private static class RequiredSignatures { @JsonProperty private boolean enabled; diff --git a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java index a6b711b6c0..19e42c51ba 100644 --- a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java +++ b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.kohsuke.github.GHBranchProtection.EnforceAdmins; import org.kohsuke.github.GHBranchProtection.RequiredReviews; -import org.kohsuke.github.GHBranchProtection.RequiredSignatures; import org.kohsuke.github.GHBranchProtection.RequiredStatusChecks; import java.io.FileNotFoundException; @@ -34,11 +33,11 @@ public void setUp() throws Exception { if (branch.isProtected()) { GHBranchProtection protection = branch.getProtection(); - if (protection.getRequiredSignatures().isEnabled()) { + if (protection.getRequiredSignatures()) { protection.disableSignedCommits(); } - assertFalse(protection.getRequiredSignatures().isEnabled()); + assertFalse(protection.getRequiredSignatures()); branch.disableProtection(); } @@ -93,17 +92,12 @@ public void testEnableRequireReviewsOnly() throws Exception { public void testSignedCommits() throws Exception { GHBranchProtection protection = branch.enableProtection().enable(); - RequiredSignatures signatures = protection.getRequiredSignatures(); - assertNotNull(signatures); - assertFalse(signatures.isEnabled()); + assertFalse(protection.getRequiredSignatures()); - signatures = protection.enabledSignedCommits(); - assertNotNull(signatures); - assertTrue(signatures.isEnabled()); + protection.enabledSignedCommits(); + assertTrue(protection.getRequiredSignatures()); protection.disableSignedCommits(); - signatures = protection.getRequiredSignatures(); - assertNotNull(signatures); - assertFalse(signatures.isEnabled()); + assertFalse(protection.getRequiredSignatures()); } } From 29a40d31b7739ec3fd46585a1ccc7bd7c569f247 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:09:54 -0700 Subject: [PATCH 18/27] TAB -> space --- .../kohsuke/github/GHBranchProtection.java | 117 +++++++++--------- 1 file changed, 58 insertions(+), 59 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java index 423576fc1d..8420a531ad 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtection.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java @@ -8,41 +8,41 @@ import java.io.IOException; import java.util.Collection; -@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", - "URF_UNREAD_FIELD" }, justification = "JSON API") +@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", + "URF_UNREAD_FIELD"}, justification = "JSON API") public class GHBranchProtection { private static final String REQUIRE_SIGNATURES_URI = "/required_signatures"; - @JsonProperty("enforce_admins") - private EnforceAdmins enforceAdmins; + @JsonProperty("enforce_admins") + private EnforceAdmins enforceAdmins; - private GitHub root; + private GitHub root; - @JsonProperty("required_pull_request_reviews") - private RequiredReviews requiredReviews; + @JsonProperty("required_pull_request_reviews") + private RequiredReviews requiredReviews; - @JsonProperty("required_status_checks") - private RequiredStatusChecks requiredStatusChecks; + @JsonProperty("required_status_checks") + private RequiredStatusChecks requiredStatusChecks; - @JsonProperty - private Restrictions restrictions; + @JsonProperty + private Restrictions restrictions; - @JsonProperty - private String url; - - @Preview @Deprecated + @JsonProperty + private String url; + + @Preview @Deprecated public void enabledSignedCommits() throws IOException { requester().method("POST") .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class); } - @Preview @Deprecated + @Preview @Deprecated public void disableSignedCommits() throws IOException { requester().method("DELETE") .to(url + REQUIRE_SIGNATURES_URI); } - public EnforceAdmins getEnforceAdmins() { + public EnforceAdmins getEnforceAdmins() { return enforceAdmins; } @@ -78,11 +78,11 @@ private Requester requester() { } public static class EnforceAdmins { - @JsonProperty - private boolean enabled; + @JsonProperty + private boolean enabled; - @JsonProperty - private String url; + @JsonProperty + private String url; public String getUrl() { return url; @@ -91,23 +91,23 @@ public String getUrl() { public boolean isEnabled() { return enabled; } - } + } - public static class RequiredReviews { - @JsonProperty("dismissal_restrictions") - private Restrictions dismissalRestriction; + public static class RequiredReviews { + @JsonProperty("dismissal_restrictions") + private Restrictions dismissalRestriction; - @JsonProperty("dismiss_stale_reviews") - private boolean dismissStaleReviews; + @JsonProperty("dismiss_stale_reviews") + private boolean dismissStaleReviews; - @JsonProperty("require_code_owner_reviews") - private boolean requireCodeOwnerReviews; + @JsonProperty("require_code_owner_reviews") + private boolean requireCodeOwnerReviews; - @JsonProperty("required_approving_review_count") - private int requiredReviewers; + @JsonProperty("required_approving_review_count") + private int requiredReviewers; - @JsonProperty - private String url; + @JsonProperty + private String url; public Restrictions getDismissalRestrictions() { return dismissalRestriction; @@ -125,14 +125,13 @@ public boolean isRequireCodeOwnerReviews() { return requireCodeOwnerReviews; } - public int getRequiredReviewers() - { + public int getRequiredReviewers() { return requiredReviewers; } - } + } - private static class RequiredSignatures { - @JsonProperty + private static class RequiredSignatures { + @JsonProperty private boolean enabled; @JsonProperty @@ -145,17 +144,17 @@ public String getUrl() { public boolean isEnabled() { return enabled; } - } + } - public static class RequiredStatusChecks { - @JsonProperty - private Collection contexts; + public static class RequiredStatusChecks { + @JsonProperty + private Collection contexts; - @JsonProperty - private boolean strict; + @JsonProperty + private boolean strict; - @JsonProperty - private String url; + @JsonProperty + private String url; public Collection getContexts() { return contexts; @@ -168,23 +167,23 @@ public String getUrl() { public boolean isRequiresBranchUpToDate() { return strict; } - } + } - public static class Restrictions { - @JsonProperty - private Collection teams; + public static class Restrictions { + @JsonProperty + private Collection teams; - @JsonProperty("teams_url") - private String teamsUrl; + @JsonProperty("teams_url") + private String teamsUrl; - @JsonProperty - private String url; + @JsonProperty + private String url; - @JsonProperty - private Collection users; + @JsonProperty + private Collection users; - @JsonProperty("users_url") - private String usersUrl; + @JsonProperty("users_url") + private String usersUrl; public Collection getTeams() { return teams; @@ -205,5 +204,5 @@ public Collection getUsers() { public String getUsersUrl() { return usersUrl; } - } + } } From c988df13a8f976b3a6d86fc2de7542541be7fd12 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:11:05 -0700 Subject: [PATCH 19/27] Use a short form --- .../java/org/kohsuke/github/GHBranchProtectionBuilder.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java index 61e9b70fea..822541a14d 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java @@ -44,8 +44,7 @@ public GHBranchProtectionBuilder addRequiredChecks(String... checks) { } public GHBranchProtectionBuilder dismissStaleReviews() { - dismissStaleReviews(true); - return this; + return dismissStaleReviews(true); } public GHBranchProtectionBuilder dismissStaleReviews(boolean v) { From 5e36377b36e05e3acc80f9c5dc0241837f19cfb0 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:13:44 -0700 Subject: [PATCH 20/27] It appears LOKI preview is done and all those methods are now final --- src/main/java/org/kohsuke/github/GHBranch.java | 4 +--- src/main/java/org/kohsuke/github/GHRepository.java | 4 ++-- src/main/java/org/kohsuke/github/Previews.java | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index dbedcb64aa..e457fc243d 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -65,9 +65,8 @@ public URL getProtectionUrl() { return GitHub.parseURL(protection_url); } - @Preview @Deprecated public GHBranchProtection getProtection() throws IOException { - return root.retrieve().withPreview(LOKI).to(protection_url, GHBranchProtection.class).wrap(this); + return root.retrieve().to(protection_url, GHBranchProtection.class).wrap(this); } /** @@ -80,7 +79,6 @@ public String getSHA1() { /** * Disables branch protection and allows anyone with push access to push changes. */ - @Preview @Deprecated public void disableProtection() throws IOException { new Requester(root).method("DELETE").to(protection_url); } diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 3c80c499ff..2b89a491d1 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1306,7 +1306,7 @@ public boolean remove(Object url) { */ public Map getBranches() throws IOException { Map r = new TreeMap(); - for (GHBranch p : root.retrieve().withPreview(LOKI).to(getApiTailUrl("branches"), GHBranch[].class)) { + for (GHBranch p : root.retrieve().to(getApiTailUrl("branches"), GHBranch[].class)) { p.wrap(this); r.put(p.getName(),p); } @@ -1314,7 +1314,7 @@ public Map getBranches() throws IOException { } public GHBranch getBranch(String name) throws IOException { - return root.retrieve().withPreview(LOKI).to(getApiTailUrl("branches/"+name),GHBranch.class).wrap(this); + return root.retrieve().to(getApiTailUrl("branches/"+name),GHBranch.class).wrap(this); } /** diff --git a/src/main/java/org/kohsuke/github/Previews.java b/src/main/java/org/kohsuke/github/Previews.java index f1686e24aa..41ac7e155b 100644 --- a/src/main/java/org/kohsuke/github/Previews.java +++ b/src/main/java/org/kohsuke/github/Previews.java @@ -4,7 +4,6 @@ * @author Kohsuke Kawaguchi */ /*package*/ class Previews { - static final String LOKI = "application/vnd.github.loki-preview+json"; static final String LUKE_CAGE = "application/vnd.github.luke-cage-preview+json"; static final String DRAX = "application/vnd.github.drax-preview+json"; static final String SQUIRREL_GIRL = "application/vnd.github.squirrel-girl-preview"; From 3b2802e36da20247bafa8bfe5da723c965a355e5 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:18:00 -0700 Subject: [PATCH 21/27] minor doc improvement --- src/main/java/org/kohsuke/github/GHInvitation.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java index 6c285fefd1..fa0cacc67c 100644 --- a/src/main/java/org/kohsuke/github/GHInvitation.java +++ b/src/main/java/org/kohsuke/github/GHInvitation.java @@ -10,6 +10,10 @@ import java.util.Map; import java.util.TreeMap; +/** + * @see GitHub#getMyInvitations() + * @see GHRepository#listInvitations() + */ public class GHInvitation extends GHObject { /*package almost final*/ GitHub root; From 92a015ca4df1ccdf0d0b7b049e951bfe571fb09c Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:18:10 -0700 Subject: [PATCH 22/27] Clear up import statements --- src/main/java/org/kohsuke/github/GHInvitation.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java index fa0cacc67c..213b7af3f1 100644 --- a/src/main/java/org/kohsuke/github/GHInvitation.java +++ b/src/main/java/org/kohsuke/github/GHInvitation.java @@ -2,13 +2,6 @@ import java.io.IOException; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; /** * @see GitHub#getMyInvitations() From cbfe72a76eecd9b18af7bf6dd9ca339371fb3d65 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:31:44 -0700 Subject: [PATCH 23/27] Fixed a broken test --- .../java/org/kohsuke/github/GHContentIntegrationTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java index b1ab9387f7..4b8bf72d63 100644 --- a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java +++ b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java @@ -53,10 +53,8 @@ public void testGetDirectoryContentTrailingSlash() throws Exception { @Test public void testCRUDContent() throws Exception { - ; GHContentUpdateResponse created = - repo.createContent("this is an awesome file I created\n", "Creating a file for integration tests.", createdFilename, - repo.getFileContent(createdFilename).getSha()); + repo.createContent("this is an awesome file I created\n", "Creating a file for integration tests.", createdFilename); GHContent createdContent = created.getContent(); assertNotNull(created.getCommit()); From 863995cb50013b6c6a7ef5c1e13f69ae964e60fe Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:48:36 -0700 Subject: [PATCH 24/27] findbugs warning fix --- src/main/java/org/kohsuke/github/GHInvitation.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java index 213b7af3f1..bfa7de7be3 100644 --- a/src/main/java/org/kohsuke/github/GHInvitation.java +++ b/src/main/java/org/kohsuke/github/GHInvitation.java @@ -1,5 +1,7 @@ package org.kohsuke.github; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import java.io.IOException; import java.net.URL; @@ -7,6 +9,8 @@ * @see GitHub#getMyInvitations() * @see GHRepository#listInvitations() */ +@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", + "NP_UNWRITTEN_FIELD"}, justification = "JSON API") public class GHInvitation extends GHObject { /*package almost final*/ GitHub root; From ee4d514b665e09b5ef04ca4b7e63971e66b4707c Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 20:48:44 -0700 Subject: [PATCH 25/27] close an opened stream --- src/main/java/org/kohsuke/github/GHRelease.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHRelease.java b/src/main/java/org/kohsuke/github/GHRelease.java index d49c0a2890..0df6b415b0 100644 --- a/src/main/java/org/kohsuke/github/GHRelease.java +++ b/src/main/java/org/kohsuke/github/GHRelease.java @@ -126,7 +126,12 @@ static GHRelease[] wrap(GHRelease[] releases, GHRepository owner) { * handling of the HTTP requests to github's API. */ public GHAsset uploadAsset(File file, String contentType) throws IOException { - return uploadAsset(file.getName(), new FileInputStream(file), contentType); + FileInputStream s = new FileInputStream(file); + try { + return uploadAsset(file.getName(), s, contentType); + } finally { + s.close(); + } } public GHAsset uploadAsset(String filename, InputStream stream, String contentType) throws IOException { From c44e5d2a876340ef2f26229f5940b494cfa75e98 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 21:00:24 -0700 Subject: [PATCH 26/27] findbugs fix --- src/main/java/org/kohsuke/github/GHInvitation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java index bfa7de7be3..74619ad6e0 100644 --- a/src/main/java/org/kohsuke/github/GHInvitation.java +++ b/src/main/java/org/kohsuke/github/GHInvitation.java @@ -10,7 +10,7 @@ * @see GHRepository#listInvitations() */ @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", - "NP_UNWRITTEN_FIELD"}, justification = "JSON API") + "NP_UNWRITTEN_FIELD", "UUF_UNUSED_FIELD"}, justification = "JSON API") public class GHInvitation extends GHObject { /*package almost final*/ GitHub root; From 5194a361f49e382009ff3853010df9aec9b9a3ee Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 29 Aug 2018 21:05:21 -0700 Subject: [PATCH 27/27] [maven-release-plugin] prepare release github-api-1.94 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3f134bed94..a0428a8a09 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ github-api - 1.94-SNAPSHOT + 1.94 GitHub API for Java http://github-api.kohsuke.org/ GitHub API for Java @@ -16,7 +16,7 @@ scm:git:git@github.com/kohsuke/${project.artifactId}.git scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git http://${project.artifactId}.kohsuke.org/ - HEAD + github-api-1.94