Skip to content

Commit

Permalink
Merge tag 'github-api-1.320' into release/v1.x-unbridged
Browse files Browse the repository at this point in the history
github-api-1.320
  • Loading branch information
bitwiseman committed Mar 18, 2024
2 parents dc51859 + 8942fd1 commit ac263b2
Show file tree
Hide file tree
Showing 262 changed files with 12,079 additions and 2,831 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on:
on:
push:
branches:
- main
Expand Down Expand Up @@ -84,15 +84,15 @@ 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: Codecov Report
if: matrix.os == 'ubuntu' && matrix.java == '17'
uses: codecov/codecov-action@v4.0.0
uses: codecov/codecov-action@v4.1.0

test-java-8:
name: test Java 8 (no-build)
needs: build
runs-on: ubuntu-latest
steps:
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
Expand All @@ -103,6 +103,6 @@ jobs:
with:
java-version: 8
distribution: 'temurin'
cache: 'maven'
cache: 'maven'
- name: Maven Test (no build) Java 8
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Release Drafter
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 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.319</version>
<version>1.320</version>
<name>GitHub API for Java</name>
<url>https://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description>
Expand Down Expand Up @@ -299,7 +299,7 @@
<dependency>
<groupId>org.apache.bcel</groupId>
<artifactId>bcel</artifactId>
<version>6.8.1</version>
<version>6.8.2</version>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -635,7 +635,7 @@
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>2.35.1</version>
<version>2.35.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
25 changes: 21 additions & 4 deletions src/main/java/org/kohsuke/github/GHApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -209,10 +210,26 @@ public void setPermissions(Map<String, String> permissions) {
*/
@Preview(MACHINE_MAN)
public PagedIterable<GHAppInstallation> listInstallations() {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath("/app/installations")
.toIterable(GHAppInstallation[].class, null);
return listInstallations(null);
}

/**
* Obtains all the installations associated with this app since a given date.
* <p>
* You must use a JWT to access this endpoint.
*
* @param since
* - Allows users to get installations that have been updated since a given date.
* @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");
if (since != null) {
requester.with("since", GitHubClient.printDate(since));
}
return requester.toIterable(GHAppInstallation[].class, null);
}

/**
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/org/kohsuke/github/GHAppInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -45,6 +46,8 @@ public class GHAppInstallation extends GHObject {
@JsonProperty("repository_selection")
private GHRepositorySelection repositorySelection;
private String htmlUrl;
private String suspendedAt;
private GHUser suspendedBy;

/**
* Gets the html url.
Expand Down Expand Up @@ -311,6 +314,25 @@ public void setRepositorySelection(GHRepositorySelection repositorySelection) {
throw new RuntimeException("Do not use this method.");
}

/**
* Gets suspended at.
*
* @return the suspended at
*/
public Date getSuspendedAt() {
return GitHubClient.parseDate(suspendedAt);
}

/**
* Gets suspended by.
*
* @return the suspended by
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public GHUser getSuspendedBy() {
return suspendedBy;
}

/**
* Delete a Github App installation
* <p>
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.kohsuke.github;

import java.io.IOException;
import java.util.Objects;

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

Expand Down Expand Up @@ -131,6 +132,23 @@ public GHCreateRepositoryBuilder fromTemplateRepository(String templateOwner, St
return this;
}

/**
* Create repository from template repository.
*
* @param templateRepository
* the template repository as a GHRepository
* @return a builder to continue with building
* @see <a href="https://developer.github.com/v3/previews/">GitHub API Previews</a>
*/
@Preview(BAPTISTE)
public GHCreateRepositoryBuilder fromTemplateRepository(GHRepository templateRepository) {
Objects.requireNonNull(templateRepository, "templateRepository cannot be null");
if (!templateRepository.isTemplate()) {
throw new IllegalArgumentException("The provided repository is not a template repository.");
}
return fromTemplateRepository(templateRepository.getOwnerName(), templateRepository.getName());
}

/**
* Creates a repository with all the parameters.
*
Expand Down
Loading

0 comments on commit ac263b2

Please sign in to comment.