Skip to content

Commit

Permalink
Merge tag 'github-api-1.323' into release/v1.x-unbridged
Browse files Browse the repository at this point in the history
github-api-1.323
  • Loading branch information
bitwiseman committed Jul 1, 2024
2 parents d997ee5 + 7aa31d5 commit 5184aa9
Show file tree
Hide file tree
Showing 3,021 changed files with 10,259 additions and 7,145 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
26 changes: 24 additions & 2 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- main-2.x
- '!/refs/heads/dependabot/*'
pull_request:
branches:
Expand Down Expand Up @@ -84,9 +85,30 @@ jobs:
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
- name: Codecov Report
- name: Save coverage data
if: matrix.os == 'ubuntu' && matrix.java == '17'
uses: codecov/codecov-action@v4.4.1
uses: actions/upload-artifact@v4
with:
name: maven-test-target-directory
path: target/
retention-days: 3
codecov-upload:
name: codecov-upload (Upload to codecov.io)
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: maven-test-target-directory
path: target
- name: Codecov Report
uses: codecov/codecov-action@v4.5.0
with:
# Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

test-java-8:
name: test Java 8 (no-build)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Run `mvn spotless:apply` to fix any formatting, etc issues.

If the following does not succeed, you will not pass the pull request checks.

`mvn -D enable-ci clean install site`
`mvn -D enable-ci clean install site "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"`

## Using WireMock and Snapshots

Expand Down
49 changes: 24 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.kohsuke</groupId>
<artifactId>github-api-unbridged</artifactId>
<version>1.322</version>
<version>1.323</version>
<name>GitHub API for Java</name>
<url>https://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description>
Expand Down Expand Up @@ -33,18 +33,18 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotbugs-maven-plugin.version>4.8.1.0</spotbugs-maven-plugin.version>
<spotbugs.version>4.7.3</spotbugs.version>
<spotbugs-maven-plugin.version>4.8.6.1</spotbugs-maven-plugin.version>
<spotbugs.version>4.8.6</spotbugs.version>
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
<hamcrest.version>2.2</hamcrest.version>
<okhttp3.version>4.9.2</okhttp3.version>
<okio.version>3.7.0</okio.version>
<okhttp3.version>4.12.0</okhttp3.version>
<okio.version>3.9.0</okio.version>
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
<jacoco.coverage.target.bundle.method>0.70</jacoco.coverage.target.bundle.method>
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
<jjwt.suite.version>0.12.5</jjwt.suite.version>
<jjwt.suite.version>0.12.6</jjwt.suite.version>

<jacoco.surefire.argLine />
<surefire.argLine />
Expand All @@ -55,12 +55,12 @@
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.13.0</version>
<version>2.1.0</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>
</extension>
<!-- Doing site publishing manually for now -->
<!--
Expand Down Expand Up @@ -102,17 +102,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.4</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<version>0.8.12</version>
<configuration>
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
<excludes>
Expand Down Expand Up @@ -193,7 +193,6 @@
<exclude>org.kohsuke.github.GHCommit.GHAuthor</exclude>

<!-- TODO: Some coverage, but more needed -->
<exclude>org.kohsuke.github.GHPullRequestReviewBuilder.DraftReviewComment</exclude>
<exclude>org.kohsuke.github.GHIssue.PullRequest</exclude>
<exclude>org.kohsuke.github.GHCommitSearchBuilder</exclude>
<exclude>org.kohsuke.github.GHRepositorySearchBuilder</exclude>
Expand Down Expand Up @@ -226,7 +225,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.7.0</version>
<configuration>
<release>8</release>
<failOnWarnings>true</failOnWarnings>
Expand Down Expand Up @@ -279,7 +278,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<version>3.1.0</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
Expand All @@ -294,18 +293,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.1</version>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
<artifactId>bcel</artifactId>
<version>6.8.2</version>
<version>6.9.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down Expand Up @@ -353,7 +352,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
Expand Down Expand Up @@ -466,7 +465,7 @@
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.15.3</version>
<version>2.17.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -477,12 +476,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
<version>1.2.0</version>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -617,7 +616,7 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>wordnet-random-name</artifactId>
<version>1.5</version>
<version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -641,13 +640,13 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
<version>2.0.13</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -835,7 +834,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.2.1</version>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-jacoco-exist</id>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/kohsuke/github/AbstractBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.kohsuke.github;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;

import javax.annotation.CheckForNull;
Expand Down Expand Up @@ -75,6 +77,7 @@ abstract class AbstractBuilder<R, S> extends GitHubInteractiveObject {
* @param baseInstance
* optional instance on which to base this builder.
*/
@SuppressFBWarnings(value = { "CT_CONSTRUCTOR_THROW" }, justification = "argument validation, internal class")
protected AbstractBuilder(@Nonnull Class<R> finalReturnType,
@Nonnull Class<S> intermediateReturnType,
@Nonnull GitHub root,
Expand Down
14 changes: 1 addition & 13 deletions src/main/java/org/kohsuke/github/GHApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import java.util.Map;
import java.util.stream.Collectors;

import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* A Github App.
Expand Down Expand Up @@ -208,7 +206,6 @@ public void setPermissions(Map<String, String> permissions) {
* @return a list of App installations
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
*/
@Preview(MACHINE_MAN)
public PagedIterable<GHAppInstallation> listInstallations() {
return listInstallations(null);
}
Expand All @@ -223,9 +220,8 @@ public PagedIterable<GHAppInstallation> listInstallations() {
* @return a list of App installations since a given time.
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
*/
@Preview(MACHINE_MAN)
public PagedIterable<GHAppInstallation> listInstallations(final Date since) {
Requester requester = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/app/installations");
Requester requester = root().createRequest().withUrlPath("/app/installations");
if (since != null) {
requester.with("since", GitHubClient.printDate(since));
}
Expand All @@ -244,10 +240,8 @@ public PagedIterable<GHAppInstallation> listInstallations(final Date since) {
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-an-installation">Get an installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationById(long id) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/app/installations/%d", id))
.fetch(GHAppInstallation.class);
}
Expand All @@ -265,10 +259,8 @@ public GHAppInstallation getInstallationById(long id) throws IOException {
* @see <a href="https://developer.github.com/v3/apps/#get-an-organization-installation">Get an organization
* installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/orgs/%s/installation", name))
.fetch(GHAppInstallation.class);
}
Expand All @@ -288,10 +280,8 @@ public GHAppInstallation getInstallationByOrganization(String name) throws IOExc
* @see <a href="https://developer.github.com/v3/apps/#get-a-repository-installation">Get a repository
* installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/repos/%s/%s/installation", ownerName, repositoryName))
.fetch(GHAppInstallation.class);
}
Expand All @@ -308,10 +298,8 @@ public GHAppInstallation getInstallationByRepository(String ownerName, String re
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-a-user-installation">Get a user installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationByUser(String name) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/users/%s/installation", name))
.fetch(GHAppInstallation.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.util.List;
import java.util.Map;

import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* Creates a access token for a GitHub App Installation.
Expand Down Expand Up @@ -108,12 +106,8 @@ public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permiss
* @throws IOException
* on error
*/
@Preview(MACHINE_MAN)
public GHAppInstallationToken create() throws IOException {
return builder.method("POST")
.withPreview(MACHINE_MAN)
.withUrlPath(apiUrlTail)
.fetch(GHAppInstallationToken.class);
return builder.method("POST").withUrlPath(apiUrlTail).fetch(GHAppInstallationToken.class);
}

}
13 changes: 2 additions & 11 deletions src/main/java/org/kohsuke/github/GHAppInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import java.util.Map;
import java.util.stream.Collectors;

import static org.kohsuke.github.internal.Previews.GAMBIT;
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* A Github App Installation.
Expand Down Expand Up @@ -135,11 +132,10 @@ public String getRepositoriesUrl() {
* {@link GHAuthenticatedAppInstallation#listRepositories()}.
*/
@Deprecated
@Preview(MACHINE_MAN)
public PagedSearchIterable<GHRepository> listRepositories() {
GitHubRequest request;

request = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
request = root().createRequest().withUrlPath("/installation/repositories").build();

return new PagedSearchIterable<>(root(), request, GHAppInstallationRepositoryResult.class);
}
Expand Down Expand Up @@ -342,13 +338,8 @@ public GHUser getSuspendedBy() {
* on error
* @see <a href="https://developer.github.com/v3/apps/#delete-an-installation">Delete an installation</a>
*/
@Preview(GAMBIT)
public void deleteInstallation() throws IOException {
root().createRequest()
.method("DELETE")
.withPreview(GAMBIT)
.withUrlPath(String.format("/app/installations/%d", getId()))
.send();
root().createRequest().method("DELETE").withUrlPath(String.format("/app/installations/%d", getId())).send();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/kohsuke/github/GHArtifactsPage.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package org.kohsuke.github;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

// TODO: Auto-generated Javadoc
/**
* Represents the one page of artifacts result when listing artifacts.
*/
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
justification = "JSON API")
class GHArtifactsPage {
private int total_count;
private GHArtifact[] artifacts;
Expand Down
Loading

0 comments on commit 5184aa9

Please sign in to comment.