Skip to content

Commit cad279e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into backport/main-1.x
2 parents e1c84cf + 3fc0451 commit cad279e

File tree

179 files changed

+14501
-70
lines changed

Some content is hidden

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

179 files changed

+14501
-70
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
steps:
4444
- name: Set up JDK
45-
uses: actions/setup-java@v2
45+
uses: actions/setup-java@v4
4646
with:
4747
distribution: 'temurin'
4848
java-version: 17

.github/workflows/maven-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
name: maven-test-target-directory
108108
path: target
109109
- name: Codecov Report
110-
uses: codecov/codecov-action@v4.5.0
110+
uses: codecov/codecov-action@v5.1.2
111111
with:
112112
# Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings
113113
token: ${{ secrets.CODECOV_TOKEN }}

pom.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
</distributionManagement>
3333

3434
<properties>
35-
<spring.boot.version>3.3.3</spring.boot.version>
35+
<spring.boot.version>3.3.5</spring.boot.version>
3636
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37-
<spotbugs-maven-plugin.version>4.8.6.3</spotbugs-maven-plugin.version>
37+
<spotbugs-maven-plugin.version>4.8.6.4</spotbugs-maven-plugin.version>
3838
<spotbugs.version>4.8.6</spotbugs.version>
3939
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
4040
<hamcrest.version>3.0</hamcrest.version>
4141
<okhttp3.version>4.12.0</okhttp3.version>
42-
<okio.version>3.9.0</okio.version>
42+
<okio.version>3.9.1</okio.version>
4343
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
4444
<jacoco.coverage.target.bundle.method>0.70</jacoco.coverage.target.bundle.method>
4545
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
@@ -85,16 +85,16 @@
8585
<plugin>
8686
<groupId>org.codehaus.mojo</groupId>
8787
<artifactId>versions-maven-plugin</artifactId>
88-
<version>2.17.1</version>
88+
<version>2.18.0</version>
8989
</plugin>
9090
<plugin>
9191
<groupId>org.apache.maven.plugins</groupId>
9292
<artifactId>maven-help-plugin</artifactId>
93-
<version>3.5.0</version>
93+
<version>3.5.1</version>
9494
</plugin>
9595
<plugin>
9696
<artifactId>maven-surefire-plugin</artifactId>
97-
<version>3.5.0</version>
97+
<version>3.5.2</version>
9898
<configuration>
9999
<!-- SUREFIRE-1226 workaround -->
100100
<trimStackTrace>false</trimStackTrace>
@@ -108,7 +108,7 @@
108108
<plugin>
109109
<groupId>org.apache.maven.plugins</groupId>
110110
<artifactId>maven-gpg-plugin</artifactId>
111-
<version>3.2.6</version>
111+
<version>3.2.7</version>
112112
</plugin>
113113
<plugin>
114114
<groupId>org.jacoco</groupId>
@@ -223,7 +223,7 @@
223223
<plugin>
224224
<groupId>org.apache.maven.plugins</groupId>
225225
<artifactId>maven-javadoc-plugin</artifactId>
226-
<version>3.10.0</version>
226+
<version>3.11.1</version>
227227
<configuration>
228228
<release>8</release>
229229
<failOnWarnings>true</failOnWarnings>
@@ -265,7 +265,7 @@
265265
<plugin>
266266
<groupId>org.apache.maven.plugins</groupId>
267267
<artifactId>maven-site-plugin</artifactId>
268-
<version>3.12.1</version>
268+
<version>3.21.0</version>
269269
</plugin>
270270
<plugin>
271271
<groupId>org.apache.maven.plugins</groupId>
@@ -285,7 +285,7 @@
285285
<plugin>
286286
<groupId>org.apache.maven.plugins</groupId>
287287
<artifactId>maven-project-info-reports-plugin</artifactId>
288-
<version>3.7.0</version>
288+
<version>3.8.0</version>
289289
<dependencies>
290290
<dependency>
291291
<groupId>org.apache.bcel</groupId>
@@ -475,7 +475,7 @@
475475
<dependency>
476476
<groupId>com.fasterxml.jackson</groupId>
477477
<artifactId>jackson-bom</artifactId>
478-
<version>2.17.2</version>
478+
<version>2.18.2</version>
479479
<scope>import</scope>
480480
<type>pom</type>
481481
</dependency>
@@ -560,7 +560,7 @@
560560
<dependency>
561561
<groupId>com.infradna.tool</groupId>
562562
<artifactId>bridge-method-annotation</artifactId>
563-
<version>1.29</version>
563+
<version>1.30</version>
564564
<optional>true</optional>
565565
</dependency>
566566
<!-- for stapler-jetty -->
@@ -649,7 +649,7 @@
649649
<dependency>
650650
<groupId>org.mockito</groupId>
651651
<artifactId>mockito-core</artifactId>
652-
<version>5.13.0</version>
652+
<version>5.14.2</version>
653653
<scope>test</scope>
654654
</dependency>
655655
<dependency>

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,22 @@ public void setPermissions(Map<String, String> permissions) {
204204
throw new RuntimeException("Do not use this method.");
205205
}
206206

207+
/**
208+
* Obtains all the installation requests associated with this app.
209+
* <p>
210+
* You must use a JWT to access this endpoint.
211+
*
212+
* @return a list of App installation requests
213+
* @see <a href=
214+
* "https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#list-installation-requests-for-the-authenticated-app">List
215+
* installation requests</a>
216+
*/
217+
public PagedIterable<GHAppInstallationRequest> listInstallationRequests() {
218+
return root().createRequest()
219+
.withUrlPath("/app/installation-requests")
220+
.toIterable(GHAppInstallationRequest[].class, null);
221+
}
222+
207223
/**
208224
* Obtains all the installations associated with this app.
209225
* <p>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.kohsuke.github;
2+
3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4+
5+
/**
6+
* A Github App Installation Request.
7+
*
8+
* @author Anuj Hydrabadi
9+
* @see GHApp#listInstallationRequests() GHApp#listInstallationRequests()
10+
*/
11+
public class GHAppInstallationRequest extends GHObject {
12+
/**
13+
* Create default GHAppInstallationRequest instance
14+
*/
15+
public GHAppInstallationRequest() {
16+
}
17+
18+
private GHOrganization account;
19+
20+
private GHUser requester;
21+
22+
/**
23+
* Gets the organization where the app was requested to be installed.
24+
*
25+
* @return the organization where the app was requested to be installed.
26+
*/
27+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP", "UWF_UNWRITTEN_FIELD" }, justification = "Expected behavior")
28+
public GHOrganization getAccount() {
29+
return account;
30+
}
31+
32+
/**
33+
* Gets the user who requested the installation.
34+
*
35+
* @return the user who requested the installation.
36+
*/
37+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP", "UWF_UNWRITTEN_FIELD" }, justification = "Expected behavior")
38+
public GHUser getRequester() {
39+
return requester;
40+
}
41+
42+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package org.kohsuke.github;
2+
3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4+
5+
import java.io.IOException;
6+
7+
/**
8+
* Represents a GitHub repository autolink reference.
9+
*
10+
* @author Alaurant
11+
* @see GHAutolinkBuilder
12+
* @see GHRepository#listAutolinks() GHRepository#listAutolinks()
13+
* @see <a href="https://docs.github.com/en/rest/repos/autolinks">Repository autolinks API</a>
14+
*/
15+
public class GHAutolink {
16+
17+
private int id;
18+
private String key_prefix;
19+
private String url_template;
20+
private boolean is_alphanumeric;
21+
private GHRepository owner;
22+
23+
/**
24+
* Instantiates a new Gh autolink.
25+
*/
26+
public GHAutolink() {
27+
}
28+
29+
/**
30+
* Gets the autolink ID
31+
*
32+
* @return the id
33+
*/
34+
public int getId() {
35+
return id;
36+
}
37+
38+
/**
39+
* Gets the key prefix used to identify issues/PR references
40+
*
41+
* @return the key prefix string
42+
*/
43+
public String getKeyPrefix() {
44+
return key_prefix;
45+
}
46+
47+
/**
48+
* Gets the URL template that will be used for matching
49+
*
50+
* @return the URL template string
51+
*/
52+
public String getUrlTemplate() {
53+
return url_template;
54+
}
55+
56+
/**
57+
* Checks if the autolink uses alphanumeric values
58+
*
59+
* @return true if alphanumeric, false otherwise
60+
*/
61+
public boolean isAlphanumeric() {
62+
return is_alphanumeric;
63+
}
64+
65+
/**
66+
* Gets the repository that owns this autolink
67+
*
68+
* @return the repository instance
69+
*/
70+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
71+
public GHRepository getOwner() {
72+
return owner;
73+
}
74+
75+
/**
76+
* Deletes this autolink
77+
*
78+
* @throws IOException
79+
* if the deletion fails
80+
*/
81+
public void delete() throws IOException {
82+
owner.root()
83+
.createRequest()
84+
.method("DELETE")
85+
.withUrlPath(String.format("/repos/%s/%s/autolinks/%d", owner.getOwnerName(), owner.getName(), getId()))
86+
.send();
87+
}
88+
89+
/**
90+
* Wraps this autolink with its owner repository.
91+
*
92+
* @param owner
93+
* the repository that owns this autolink
94+
* @return this instance
95+
*/
96+
GHAutolink lateBind(GHRepository owner) {
97+
this.owner = owner;
98+
return this;
99+
}
100+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package org.kohsuke.github;
2+
3+
import java.io.IOException;
4+
5+
// TODO: Auto-generated Javadoc
6+
/**
7+
* The type Gh autolink builder.
8+
*
9+
* @see GHRepository#createAutolink()
10+
* @see GHAutolink
11+
*/
12+
public class GHAutolinkBuilder {
13+
14+
private final GHRepository repo;
15+
private final Requester req;
16+
private String keyPrefix;
17+
private String urlTemplate;
18+
private Boolean isAlphanumeric;
19+
20+
/**
21+
* Instantiates a new Gh autolink builder.
22+
*
23+
* @param repo
24+
* the repo
25+
*/
26+
GHAutolinkBuilder(GHRepository repo) {
27+
this.repo = repo;
28+
req = repo.root().createRequest();
29+
}
30+
31+
/**
32+
* With key prefix gh autolink builder.
33+
*
34+
* @param keyPrefix
35+
* the key prefix
36+
* @return the gh autolink builder
37+
*/
38+
public GHAutolinkBuilder withKeyPrefix(String keyPrefix) {
39+
this.keyPrefix = keyPrefix;
40+
return this;
41+
}
42+
43+
/**
44+
* With url template gh autolink builder.
45+
*
46+
* @param urlTemplate
47+
* the url template
48+
* @return the gh autolink builder
49+
*/
50+
public GHAutolinkBuilder withUrlTemplate(String urlTemplate) {
51+
this.urlTemplate = urlTemplate;
52+
return this;
53+
}
54+
55+
/**
56+
* With is alphanumeric gh autolink builder.
57+
*
58+
* @param isAlphanumeric
59+
* the is alphanumeric
60+
* @return the gh autolink builder
61+
*/
62+
public GHAutolinkBuilder withIsAlphanumeric(boolean isAlphanumeric) {
63+
this.isAlphanumeric = isAlphanumeric;
64+
return this;
65+
}
66+
67+
private String getApiTail() {
68+
return String.format("/repos/%s/%s/autolinks", repo.getOwnerName(), repo.getName());
69+
}
70+
71+
/**
72+
* Create gh autolink.
73+
*
74+
* @return the gh autolink
75+
* @throws IOException
76+
* the io exception
77+
*/
78+
public GHAutolink create() throws IOException {
79+
GHAutolink autolink = req.method("POST")
80+
.with("key_prefix", keyPrefix)
81+
.with("url_template", urlTemplate)
82+
.with("is_alphanumeric", isAlphanumeric)
83+
.withHeader("Accept", "application/vnd.github+json")
84+
.withUrlPath(getApiTail())
85+
.fetch(GHAutolink.class);
86+
87+
return autolink.lateBind(repo);
88+
}
89+
90+
}

0 commit comments

Comments
 (0)