Skip to content

Commit a85ff6b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into bugfix/webhook-label-null-handling
2 parents 85e086d + 3ecd46e commit a85ff6b

File tree

97 files changed

+17294
-147
lines changed

Some content is hidden

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

97 files changed

+17294
-147
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
java-version: 17
4949

5050
- name: Checkout repository
51-
uses: actions/checkout@v5
51+
uses: actions/checkout@v6
5252

5353
# Initializes the CodeQL tools for scanning.
5454
- name: Initialize CodeQL

.github/workflows/create_release_tag_and_pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
create_release_tag:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
with:
1515
fetch-depth: 0
1616

@@ -35,7 +35,7 @@ jobs:
3535
mvn -B versions:set versions:commit -DremoveSnapshot
3636
echo "version=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
3737
38-
- uses: stefanzweifel/git-auto-commit-action@v6
38+
- uses: stefanzweifel/git-auto-commit-action@v7
3939
with:
4040
commit_message: "Prepare release (${{ github.actor }}): github-api-${{ steps.release.outputs.version }}"
4141
tagging_message: 'github-api-${{ steps.release.outputs.version }}'
@@ -45,7 +45,7 @@ jobs:
4545
run: |
4646
mvn versions:set versions:commit -DnextSnapshot
4747
48-
- uses: stefanzweifel/git-auto-commit-action@v6
48+
- uses: stefanzweifel/git-auto-commit-action@v7
4949
with:
5050
commit_message: "Prepare for next development iteration"
5151
branch: staging/${{ github.ref_name }}

.github/workflows/maven-build.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: true
2727
steps:
28-
- uses: actions/checkout@v5
28+
- uses: actions/checkout@v6
2929
- name: Set up JDK
3030
uses: actions/setup-java@v5
3131
with:
@@ -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@v5
39+
- uses: actions/upload-artifact@v7
4040
with:
4141
name: maven-target-directory
4242
path: target/
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
fail-fast: false
4949
steps:
50-
- uses: actions/checkout@v5
50+
- uses: actions/checkout@v6
5151
- name: Set up JDK
5252
uses: actions/setup-java@v5
5353
with:
@@ -68,7 +68,7 @@ jobs:
6868
strategy:
6969
fail-fast: true
7070
steps:
71-
- uses: actions/checkout@v5
71+
- uses: actions/checkout@v6
7272
- name: Set up JDK
7373
uses: actions/setup-java@v5
7474
with:
@@ -90,7 +90,7 @@ jobs:
9090
os: [ ubuntu, windows ]
9191
java: [ 17, 21 ]
9292
steps:
93-
- uses: actions/checkout@v5
93+
- uses: actions/checkout@v6
9494
- name: Set up JDK
9595
uses: actions/setup-java@v5
9696
with:
@@ -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@v5
113+
uses: actions/upload-artifact@v7
114114
with:
115115
name: maven-test-target-directory
116116
path: target/
@@ -120,13 +120,13 @@ jobs:
120120
needs: test
121121
runs-on: ubuntu-latest
122122
steps:
123-
- uses: actions/checkout@v5
124-
- uses: actions/download-artifact@v6
123+
- uses: actions/checkout@v6
124+
- uses: actions/download-artifact@v8
125125
with:
126126
name: maven-test-target-directory
127127
path: target
128128
- name: Codecov Report
129-
uses: codecov/codecov-action@v5.5.1
129+
uses: codecov/codecov-action@v5.5.2
130130
with:
131131
# Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings
132132
token: ${{ secrets.CODECOV_TOKEN }}
@@ -138,8 +138,8 @@ jobs:
138138
needs: build
139139
runs-on: ubuntu-latest
140140
steps:
141-
- uses: actions/checkout@v5
142-
- uses: actions/download-artifact@v6
141+
- uses: actions/checkout@v6
142+
- uses: actions/download-artifact@v8
143143
with:
144144
name: maven-target-directory
145145
path: target

.github/workflows/publish_release_branch.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- name: Set up Maven Central Repository
1717
uses: actions/setup-java@v5
1818
with:
@@ -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@v5
28+
- uses: actions/upload-artifact@v7
2929
with:
3030
name: maven-release-target-directory
3131
path: target/
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
needs: build
3737
steps:
38-
- uses: actions/checkout@v5
38+
- uses: actions/checkout@v6
3939
- name: Set up Maven Central Repository
4040
uses: actions/setup-java@v5
4141
with:
@@ -69,7 +69,7 @@ jobs:
6969
needs: build
7070
if: ${{ github.ref == 'refs/heads/release/v2.x' }}
7171
steps:
72-
- uses: actions/checkout@v5
72+
- uses: actions/checkout@v6
7373
with:
7474
fetch-depth: 0
7575

@@ -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@v6
81+
- uses: actions/download-artifact@v8
8282
with:
8383
name: maven-release-target-directory
8484
path: target
@@ -90,7 +90,7 @@ jobs:
9090
cp -r ./target/site/* ./
9191
9292
- name: Publish GH Pages
93-
uses: stefanzweifel/git-auto-commit-action@v6
93+
uses: stefanzweifel/git-auto-commit-action@v7
9494
with:
9595
commit_message: "Release (${{ github.actor }}): v${{ steps.release.outputs.version }}"
9696
branch: gh-pages

pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@
7171
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
7272

7373
<jacoco.surefire.argLine></jacoco.surefire.argLine>
74-
<jjwt.suite.version>0.12.6</jjwt.suite.version>
74+
<jjwt.suite.version>0.13.0</jjwt.suite.version>
7575
<!-- This project was registered before 2021, so it uses the old server. -->
7676
<nexus.serverUrl>https://ossrh-staging-api.central.sonatype.com</nexus.serverUrl>
7777
<okhttp3.version>4.12.0</okhttp3.version>
7878
<okio.version>3.16.0</okio.version>
7979
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8080
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
81-
<spotbugs-maven-plugin.version>4.9.8.1</spotbugs-maven-plugin.version>
81+
<spotbugs-maven-plugin.version>4.9.8.2</spotbugs-maven-plugin.version>
8282
<spotbugs.version>4.8.6</spotbugs.version>
8383
<spring.boot.version>3.4.5</spring.boot.version>
8484
<surefire.argLine></surefire.argLine>
@@ -89,7 +89,7 @@
8989
<dependency>
9090
<groupId>com.fasterxml.jackson</groupId>
9191
<artifactId>jackson-bom</artifactId>
92-
<version>2.20.0</version>
92+
<version>2.21.0</version>
9393
<type>pom</type>
9494
<scope>import</scope>
9595
</dependency>
@@ -268,7 +268,7 @@
268268
<dependency>
269269
<groupId>org.mockito</groupId>
270270
<artifactId>mockito-core</artifactId>
271-
<version>5.16.1</version>
271+
<version>5.21.0</version>
272272
<scope>test</scope>
273273
</dependency>
274274
<!--
@@ -320,7 +320,7 @@
320320
<plugin>
321321
<groupId>org.apache.maven.plugins</groupId>
322322
<artifactId>maven-gpg-plugin</artifactId>
323-
<version>3.2.7</version>
323+
<version>3.2.8</version>
324324
</plugin>
325325
<plugin>
326326
<groupId>org.apache.maven.plugins</groupId>
@@ -348,7 +348,7 @@
348348
</plugin>
349349
<plugin>
350350
<artifactId>maven-surefire-plugin</artifactId>
351-
<version>3.5.3</version>
351+
<version>3.5.5</version>
352352
<configuration>
353353
<!-- SUREFIRE-1226 workaround -->
354354
<trimStackTrace>false</trimStackTrace>
@@ -362,7 +362,7 @@
362362
<plugin>
363363
<groupId>org.jacoco</groupId>
364364
<artifactId>jacoco-maven-plugin</artifactId>
365-
<version>0.8.13</version>
365+
<version>0.8.14</version>
366366
<configuration>
367367
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
368368
<excludes>
@@ -619,7 +619,7 @@
619619
<dependency>
620620
<groupId>org.apache.bcel</groupId>
621621
<artifactId>bcel</artifactId>
622-
<version>6.10.0</version>
622+
<version>6.12.0</version>
623623
</dependency>
624624
</dependencies>
625625
</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()).readValue(payload.traverse(), type);
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
*

0 commit comments

Comments
 (0)