Skip to content

Commit 983e63d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into jackson-3-phase-2
2 parents 61848e6 + 3ecd46e commit 983e63d

91 files changed

Lines changed: 17230 additions & 113 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/maven-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
env:
3737
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
3838
run: mvn -B clean install -DskipTests --file pom.xml
39-
- uses: actions/upload-artifact@v6
39+
- uses: actions/upload-artifact@v7
4040
with:
4141
name: maven-target-directory
4242
path: target/
@@ -110,7 +110,7 @@ jobs:
110110
run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
111111
- name: Save coverage data
112112
if: matrix.os == 'ubuntu' && matrix.java == '17'
113-
uses: actions/upload-artifact@v6
113+
uses: actions/upload-artifact@v7
114114
with:
115115
name: maven-test-target-directory
116116
path: target/
@@ -121,7 +121,7 @@ jobs:
121121
runs-on: ubuntu-latest
122122
steps:
123123
- uses: actions/checkout@v6
124-
- uses: actions/download-artifact@v7
124+
- uses: actions/download-artifact@v8
125125
with:
126126
name: maven-test-target-directory
127127
path: target
@@ -139,7 +139,7 @@ jobs:
139139
runs-on: ubuntu-latest
140140
steps:
141141
- uses: actions/checkout@v6
142-
- uses: actions/download-artifact@v7
142+
- uses: actions/download-artifact@v8
143143
with:
144144
name: maven-target-directory
145145
path: target

.github/workflows/publish_release_branch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
2626
run: mvn -B clean install site -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
2727

28-
- uses: actions/upload-artifact@v6
28+
- uses: actions/upload-artifact@v7
2929
with:
3030
name: maven-release-target-directory
3131
path: target/
@@ -78,7 +78,7 @@ jobs:
7878
run: |
7979
echo "version=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
8080
81-
- uses: actions/download-artifact@v7
81+
- uses: actions/download-artifact@v8
8282
with:
8383
name: maven-release-target-directory
8484
path: target

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
<plugin>
338338
<groupId>org.apache.maven.plugins</groupId>
339339
<artifactId>maven-gpg-plugin</artifactId>
340-
<version>3.2.7</version>
340+
<version>3.2.8</version>
341341
</plugin>
342342
<plugin>
343343
<groupId>org.apache.maven.plugins</groupId>
@@ -365,7 +365,7 @@
365365
</plugin>
366366
<plugin>
367367
<artifactId>maven-surefire-plugin</artifactId>
368-
<version>3.5.3</version>
368+
<version>3.5.5</version>
369369
<configuration>
370370
<!-- SUREFIRE-1226 workaround -->
371371
<trimStackTrace>false</trimStackTrace>
@@ -379,7 +379,7 @@
379379
<plugin>
380380
<groupId>org.jacoco</groupId>
381381
<artifactId>jacoco-maven-plugin</artifactId>
382-
<version>0.8.13</version>
382+
<version>0.8.14</version>
383383
<configuration>
384384
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
385385
<excludes>
@@ -636,7 +636,7 @@
636636
<dependency>
637637
<groupId>org.apache.bcel</groupId>
638638
<artifactId>bcel</artifactId>
639-
<version>6.10.0</version>
639+
<version>6.12.0</version>
640640
</dependency>
641641
</dependencies>
642642
</plugin>

src/main/java/org/kohsuke/github/GHEventInfo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.kohsuke.github;
22

3-
import com.fasterxml.jackson.databind.node.ObjectNode;
43
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
54
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
65

@@ -84,8 +83,7 @@ static GHEvent transformTypeToGHEvent(String type) {
8483
private long id;
8584
private GHOrganization org;
8685

87-
// we don't want to expose Jackson dependency to the user. This needs databinding
88-
private ObjectNode payload;
86+
private Object payload;
8987

9088
// these are all shallow objects
9189
private GHEventRepository repo;
@@ -174,7 +172,9 @@ public GHOrganization getOrganization() throws IOException {
174172
* if payload cannot be parsed
175173
*/
176174
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
177-
T v = GitHubClient.getMappingObjectReader(root()).forType(type).readValue(payload);
175+
T v = GitHubClient.getMappingObjectReader(root())
176+
.forType(type)
177+
.readValue(GitHubClient.getMappingObjectWriter().writeValueAsString(payload));
178178
v.lateBind();
179179
return v;
180180
}

src/main/java/org/kohsuke/github/GHIssueSearchBuilder.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ public GHIssueSearchBuilder isClosed() {
5757
return q("is:closed");
5858
}
5959

60+
/**
61+
* Filters results to only include issues (excludes pull requests).
62+
*
63+
* @return the gh issue search builder
64+
*/
65+
public GHIssueSearchBuilder isIssue() {
66+
terms.removeIf("is:pr"::equals);
67+
return q("is:issue");
68+
}
69+
6070
/**
6171
* Is merged gh issue search builder.
6272
*
@@ -75,6 +85,16 @@ public GHIssueSearchBuilder isOpen() {
7585
return q("is:open");
7686
}
7787

88+
/**
89+
* Filters results to only include pull requests (excludes issues).
90+
*
91+
* @return the gh issue search builder
92+
*/
93+
public GHIssueSearchBuilder isPullRequest() {
94+
terms.removeIf("is:issue"::equals);
95+
return q("is:pr");
96+
}
97+
7898
/**
7999
* Mentions gh issue search builder.
80100
*
@@ -121,6 +141,19 @@ public GHIssueSearchBuilder q(String term) {
121141
return this;
122142
}
123143

144+
/**
145+
* Filters results to a specific repository.
146+
*
147+
* @param owner
148+
* the repository owner
149+
* @param name
150+
* the repository name
151+
* @return the gh issue search builder
152+
*/
153+
public GHIssueSearchBuilder repo(String owner, String name) {
154+
return q("repo:" + owner + "/" + name);
155+
}
156+
124157
/**
125158
* Sort gh issue search builder.
126159
*

src/main/java/org/kohsuke/github/GHPullRequest.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,16 @@ public boolean isMerged() throws IOException {
492492
return merged;
493493
}
494494

495+
/**
496+
* Since a GHPullRequest is always a pull request, this method always returns true.
497+
*
498+
* @return true
499+
*/
500+
@Override
501+
public boolean isPullRequest() {
502+
return true;
503+
}
504+
495505
/**
496506
* Retrieves all the commits associated to this pull request.
497507
*
@@ -520,7 +530,13 @@ public PagedIterable<GHPullRequestFileDetail> listFiles() {
520530
/**
521531
* Obtains all the review comments associated with this pull request.
522532
*
533+
* <p>
534+
* Unlike {@link GHPullRequestReview#listReviewComments()}, this method returns full
535+
* {@link GHPullRequestReviewComment} objects including line-related fields such as
536+
* {@link GHPullRequestReviewComment#getLine() line}, {@link GHPullRequestReviewComment#getSide() side}, etc.
537+
*
523538
* @return the paged iterable
539+
* @see GHPullRequestReview#listReviewComments()
524540
*/
525541
public PagedIterable<GHPullRequestReviewComment> listReviewComments() {
526542
return root().createRequest()
@@ -539,6 +555,30 @@ public PagedIterable<GHPullRequestReview> listReviews() {
539555
.toIterable(GHPullRequestReview[].class, item -> item.wrapUp(this));
540556
}
541557

558+
/**
559+
* Converts a draft pull request to ready for review.
560+
*
561+
* @throws IOException
562+
* the io exception
563+
* @throws IllegalStateException
564+
* if the pull request is not a draft
565+
*/
566+
public void markReadyForReview() throws IOException {
567+
if (!draft) {
568+
throw new IllegalStateException("Pull request is not a draft");
569+
}
570+
571+
StringBuilder inputBuilder = new StringBuilder();
572+
addParameter(inputBuilder, "pullRequestId", this.getNodeId());
573+
574+
String graphqlBody = "mutation MarkReadyForReview { markPullRequestReadyForReview(input: {" + inputBuilder
575+
+ "}) { pullRequest { id } } }";
576+
577+
root().createGraphQLRequest(graphqlBody).sendGraphQL();
578+
579+
refresh();
580+
}
581+
542582
/**
543583
* Merge this pull request.
544584
*

src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ public PagedIterable<GHPullRequest> list() {
8686
.toIterable(GHPullRequest[].class, item -> item.wrapUp(repo));
8787
}
8888

89+
/**
90+
* Page size gh pull request query builder.
91+
*
92+
* @param pageSize
93+
* the page size
94+
* @return the gh pull request query builder
95+
*/
96+
public GHPullRequestQueryBuilder pageSize(int pageSize) {
97+
req.with("per_page", pageSize);
98+
return this;
99+
}
100+
89101
/**
90102
* Sort gh pull request query builder.
91103
*

0 commit comments

Comments
 (0)