Skip to content

Commit 3e796cd

Browse files
authored
Merge branch 'main' into issue/site-java-17
2 parents 31fed7c + 4c6c312 commit 3e796cd

349 files changed

Lines changed: 22101 additions & 2147 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/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@v1
49+
uses: github/codeql-action/init@v2
5050
with:
5151
languages: ${{ matrix.language }}
5252
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -57,7 +57,7 @@ jobs:
5757
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5858
# If this step fails, then you should remove it and run the build manually (see below)
5959
- name: Autobuild
60-
uses: github/codeql-action/autobuild@v1
60+
uses: github/codeql-action/autobuild@v2
6161

6262
# ℹ️ Command-line programs to run using the OS shell.
6363
# 📚 https://git.io/JvXDl
@@ -71,4 +71,4 @@ jobs:
7171
# make release
7272

7373
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@v1
74+
uses: github/codeql-action/analyze@v2

.github/workflows/maven-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ jobs:
7676
- name: Maven Install with Code Coverage
7777
run: mvn -B clean install -D enable-ci -Djapicmp.skip --file pom.xml
7878
- name: Codecov Report
79-
uses: codecov/codecov-action@v3.0.0
79+
uses: codecov/codecov-action@v3.1.0
8080
test:
8181
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
8282
runs-on: ${{ matrix.os }}-latest
8383
strategy:
8484
fail-fast: false
8585
matrix:
8686
os: [ ubuntu, windows ]
87-
java: [ 11.0.3, 11, 17 ]
87+
java: [ 11, 17 ]
8888
steps:
8989
- uses: actions/checkout@v3
9090
- name: Set up JDK

pom.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.kohsuke</groupId>
44
<artifactId>github-api</artifactId>
5-
<version>1.305-SNAPSHOT</version>
5+
<version>1.309-SNAPSHOT</version>
66
<name>GitHub API for Java</name>
77
<url>https://github-api.kohsuke.org/</url>
88
<description>GitHub API for Java</description>
@@ -33,8 +33,8 @@
3333

3434
<properties>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36-
<spotbugs-maven-plugin.version>4.6.0.0</spotbugs-maven-plugin.version>
37-
<spotbugs.version>4.6.0</spotbugs.version>
36+
<spotbugs-maven-plugin.version>4.7.1.1</spotbugs-maven-plugin.version>
37+
<spotbugs.version>4.7.1</spotbugs.version>
3838
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
3939
<hamcrest.version>2.2</hamcrest.version>
4040
<okhttp3.version>4.9.2</okhttp3.version>
@@ -44,7 +44,7 @@
4444
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
4545
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
4646
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
47-
<jjwt.suite.version>0.11.2</jjwt.suite.version>
47+
<jjwt.suite.version>0.11.5</jjwt.suite.version>
4848

4949
<jacoco.surefire.argLine />
5050
<surefire.argLine />
@@ -55,12 +55,12 @@
5555
<extension>
5656
<groupId>org.apache.maven.scm</groupId>
5757
<artifactId>maven-scm-provider-gitexe</artifactId>
58-
<version>1.12.2</version>
58+
<version>1.13.0</version>
5959
</extension>
6060
<extension>
6161
<groupId>org.apache.maven.scm</groupId>
6262
<artifactId>maven-scm-manager-plexus</artifactId>
63-
<version>1.12.2</version>
63+
<version>1.13.0</version>
6464
</extension>
6565
<!-- Doing site publishing manually for now -->
6666
<!--
@@ -213,7 +213,7 @@
213213
<plugin>
214214
<groupId>org.apache.maven.plugins</groupId>
215215
<artifactId>maven-javadoc-plugin</artifactId>
216-
<version>3.3.2</version>
216+
<version>3.4.1</version>
217217
<configuration>
218218
<source>8</source>
219219
<failOnWarnings>true</failOnWarnings>
@@ -223,7 +223,7 @@
223223
<plugin>
224224
<groupId>org.sonatype.plugins</groupId>
225225
<artifactId>nexus-staging-maven-plugin</artifactId>
226-
<version>1.6.12</version>
226+
<version>1.6.13</version>
227227
<extensions>true</extensions>
228228
<configuration>
229229
<serverId>sonatype-nexus-staging</serverId>
@@ -234,7 +234,7 @@
234234
<plugin>
235235
<groupId>org.codehaus.mojo</groupId>
236236
<artifactId>animal-sniffer-maven-plugin</artifactId>
237-
<version>1.21</version>
237+
<version>1.22</version>
238238
<configuration>
239239
<signature>
240240
<groupId>org.codehaus.mojo.signature</groupId>
@@ -258,7 +258,7 @@
258258
<plugin>
259259
<groupId>org.apache.maven.plugins</groupId>
260260
<artifactId>maven-site-plugin</artifactId>
261-
<version>3.11.0</version>
261+
<version>3.12.1</version>
262262
</plugin>
263263
<plugin>
264264
<groupId>org.apache.maven.plugins</groupId>
@@ -278,7 +278,7 @@
278278
<plugin>
279279
<groupId>org.apache.maven.plugins</groupId>
280280
<artifactId>maven-project-info-reports-plugin</artifactId>
281-
<version>3.2.2</version>
281+
<version>3.4.1</version>
282282
<dependencies>
283283
<dependency>
284284
<groupId>org.apache.bcel</groupId>
@@ -333,7 +333,7 @@
333333
<plugin>
334334
<groupId>com.diffplug.spotless</groupId>
335335
<artifactId>spotless-maven-plugin</artifactId>
336-
<version>2.22.1</version>
336+
<version>2.25.0</version>
337337
<executions>
338338
<execution>
339339
<id>spotless-check</id>
@@ -396,7 +396,7 @@
396396
<plugin>
397397
<groupId>com.github.siom79.japicmp</groupId>
398398
<artifactId>japicmp-maven-plugin</artifactId>
399-
<version>0.15.7</version>
399+
<version>0.16.0</version>
400400
<configuration>
401401
<parameter>
402402
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
@@ -468,7 +468,7 @@
468468
<dependency>
469469
<groupId>com.fasterxml.jackson.core</groupId>
470470
<artifactId>jackson-databind</artifactId>
471-
<version>2.13.2.2</version>
471+
<version>2.13.3</version>
472472
</dependency>
473473
<dependency>
474474
<groupId>commons-io</groupId>
@@ -567,7 +567,7 @@
567567
<dependency>
568568
<groupId>org.mockito</groupId>
569569
<artifactId>mockito-core</artifactId>
570-
<version>4.4.0</version>
570+
<version>4.7.0</version>
571571
<scope>test</scope>
572572
</dependency>
573573
<dependency>
@@ -585,7 +585,7 @@
585585
<dependency>
586586
<groupId>com.google.code.gson</groupId>
587587
<artifactId>gson</artifactId>
588-
<version>2.9.0</version>
588+
<version>2.9.1</version>
589589
<scope>test</scope>
590590
</dependency>
591591
<dependency>
@@ -698,7 +698,7 @@
698698
<plugin>
699699
<groupId>org.apache.maven.plugins</groupId>
700700
<artifactId>maven-enforcer-plugin</artifactId>
701-
<version>3.0.0</version>
701+
<version>3.1.0</version>
702702
<executions>
703703
<execution>
704704
<id>enforce-jacoco-exist</id>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class GHApp extends GHObject {
2222

2323
private GHUser owner;
2424
private String name;
25+
private String slug;
2526
private String description;
2627
private String externalUrl;
2728
private Map<String, String> permissions;
@@ -60,6 +61,15 @@ public String getName() {
6061
return name;
6162
}
6263

64+
/**
65+
* Gets the slug name of the GitHub app.
66+
*
67+
* @return the slug name of the GitHub app
68+
*/
69+
public String getSlug() {
70+
return slug;
71+
}
72+
6373
/**
6474
* Sets name.
6575
*

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
4646
return this;
4747
}
4848

49+
/**
50+
* By default the installation token has access to all repositories that the installation can access. To restrict
51+
* the access to specific repositories, you can provide repository names when creating the token.
52+
*
53+
* @param repositories
54+
* Array containing the repository names
55+
* @return a GHAppCreateTokenBuilder
56+
*/
57+
@BetaApi
58+
public GHAppCreateTokenBuilder repositories(List<String> repositories) {
59+
this.builder.with("repositories", repositories);
60+
return this;
61+
}
62+
4963
/**
5064
* Set the permissions granted to the access token. The permissions object includes the permission names and their
5165
* access type.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,15 @@ public String getRepositoriesUrl() {
117117
* List repositories that this app installation can access.
118118
*
119119
* @return the paged iterable
120+
* @deprecated This method cannot work on a {@link GHAppInstallation} retrieved from
121+
* {@link GHApp#listInstallations()} (for example), except when resorting to unsupported hacks involving
122+
* {@link GHAppInstallation#setRoot(GitHub)} to switch from an application client to an installation
123+
* client. This method will be removed. You should instead use an installation client (with an
124+
* installation token, not a JWT), retrieve a {@link GHAuthenticatedAppInstallation} from
125+
* {@link GitHub#getInstallation()}, then call
126+
* {@link GHAuthenticatedAppInstallation#listRepositories()}.
120127
*/
128+
@Deprecated
121129
@Preview(MACHINE_MAN)
122130
public PagedSearchIterable<GHRepository> listRepositories() {
123131
GitHubRequest request;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public URL getHtmlUrl() throws IOException {
9999
* the io exception
100100
*/
101101
public void delete() throws IOException {
102-
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).fetchHttpStatusCode();
102+
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
103103
}
104104

105105
/**
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.kohsuke.github;
2+
3+
import javax.annotation.Nonnull;
4+
5+
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
6+
7+
/**
8+
* The Github App Installation corresponding to the installation token used in a client.
9+
*
10+
* @see GitHub#getInstallation() GitHub#getAuthenticatedAppInstallation()
11+
*/
12+
public class GHAuthenticatedAppInstallation extends GitHubInteractiveObject {
13+
protected GHAuthenticatedAppInstallation(@Nonnull GitHub root) {
14+
super(root);
15+
}
16+
17+
/**
18+
* List repositories that this app installation can access.
19+
*
20+
* @return the paged iterable
21+
*/
22+
@Preview(MACHINE_MAN)
23+
public PagedSearchIterable<GHRepository> listRepositories() {
24+
GitHubRequest request;
25+
26+
request = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
27+
28+
return new PagedSearchIterable<>(root(), request, GHAuthenticatedAppInstallationRepositoryResult.class);
29+
}
30+
31+
private static class GHAuthenticatedAppInstallationRepositoryResult extends SearchResult<GHRepository> {
32+
private GHRepository[] repositories;
33+
34+
@Override
35+
GHRepository[] getItems(GitHub root) {
36+
return repositories;
37+
}
38+
}
39+
40+
}

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

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,43 @@ void lateBind() {
15061506
}
15071507
}
15081508

1509+
/**
1510+
* A workflow job has been queued, is in progress, or has been completed.
1511+
*
1512+
* @see <a href=
1513+
* "https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job">
1514+
* workflow job event</a>
1515+
* @see <a href="https://docs.github.com/en/rest/reference/actions#workflow-jobs">Actions Workflow Jobs</a>
1516+
*/
1517+
public static class WorkflowJob extends GHEventPayload {
1518+
1519+
private GHWorkflowJob workflowJob;
1520+
1521+
/**
1522+
* Gets the workflow job.
1523+
*
1524+
* @return the workflow job
1525+
*/
1526+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected")
1527+
public GHWorkflowJob getWorkflowJob() {
1528+
return workflowJob;
1529+
}
1530+
1531+
@Override
1532+
void lateBind() {
1533+
if (workflowJob == null) {
1534+
throw new IllegalStateException(
1535+
"Expected workflow_job payload, but got something else. Maybe we've got another type of event?");
1536+
}
1537+
super.lateBind();
1538+
GHRepository repository = getRepository();
1539+
if (repository == null) {
1540+
throw new IllegalStateException("Repository must not be null");
1541+
}
1542+
workflowJob.wrapUp(repository);
1543+
}
1544+
}
1545+
15091546
/**
15101547
* A label was created, edited or deleted.
15111548
*
@@ -1572,4 +1609,47 @@ public GHLabel getLabel() {
15721609
return label;
15731610
}
15741611
}
1612+
1613+
/**
1614+
* A star was created or deleted on a repository.
1615+
*
1616+
* @see <a href=
1617+
* "https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#star">star
1618+
* event</a>
1619+
*/
1620+
public static class Star extends GHEventPayload {
1621+
1622+
private String starredAt;
1623+
1624+
/**
1625+
* Gets the date when the star is added. Is null when the star is deleted.
1626+
*
1627+
* @return the date when the star is added
1628+
*/
1629+
public Date getStarredAt() {
1630+
return GitHubClient.parseDate(starredAt);
1631+
}
1632+
}
1633+
1634+
/**
1635+
* A project v2 item was archived, converted, created, edited, restored, deleted, or reordered.
1636+
*
1637+
* @see <a href=
1638+
* "https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item">star
1639+
* event</a>
1640+
*/
1641+
public static class ProjectsV2Item extends GHEventPayload {
1642+
1643+
private GHProjectsV2Item projectsV2Item;
1644+
private GHProjectsV2ItemChanges changes;
1645+
1646+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected")
1647+
public GHProjectsV2Item getProjectsV2Item() {
1648+
return projectsV2Item;
1649+
}
1650+
1651+
public GHProjectsV2ItemChanges getChanges() {
1652+
return changes;
1653+
}
1654+
}
15751655
}

0 commit comments

Comments
 (0)