From 5b3dbfba88451e3079c52936cfe28eb2e4e97a1a Mon Sep 17 00:00:00 2001 From: rball11 Date: Wed, 11 Feb 2026 10:09:15 -0700 Subject: [PATCH 1/4] feat: Added matching-ref API. [2155](https://github.com/hub4j/github-api/issues/2155) --- src/main/java/org/kohsuke/github/GHRef.java | 18 ++++++++++++ .../java/org/kohsuke/github/GHRepository.java | 12 ++++++++ .../org/kohsuke/github/GHRepositoryTest.java | 29 +++++++++++++++++++ .../listMatchingRefs/mappings/1-user.json | 13 +++++++++ .../4-r_h_g_git_matching-refs_heads.json | 13 +++++++++ .../5-r_h_g_git_matching-refs_refs_heads.json | 13 +++++++++ 6 files changed, 98 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/4-r_h_g_git_matching-refs_heads.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/5-r_h_g_git_matching-refs_refs_heads.json diff --git a/src/main/java/org/kohsuke/github/GHRef.java b/src/main/java/org/kohsuke/github/GHRef.java index 33d54792db..53ddabc328 100644 --- a/src/main/java/org/kohsuke/github/GHRef.java +++ b/src/main/java/org/kohsuke/github/GHRef.java @@ -126,6 +126,24 @@ static PagedIterable readMatching(GHRepository repository, String refType return repository.root().createRequest().withUrlPath(url).toIterable(GHRef[].class, item -> repository.root()); } + /** + * Retrieves all refs that match the given prefix using the matching-refs endpoint. + * + * @param repository + * the repository to read from + * @param refPrefix + * the ref prefix to search for e.g. heads/main or tags/v1 + * @return paged iterable of all refs matching the specified prefix + */ + static PagedIterable readMatchingRefs(GHRepository repository, String refPrefix) { + if (refPrefix.startsWith("refs/")) { + refPrefix = refPrefix.replaceFirst("refs/", ""); + } + + String url = repository.getApiTailUrl(String.format("git/matching-refs/%s", refPrefix)); + return repository.root().createRequest().withUrlPath(url).toIterable(GHRef[].class, item -> repository.root()); + } + private GHObject object; private String ref, url; diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 1ecd86f0bd..e80efcc7d6 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -2868,6 +2868,18 @@ public PagedIterable listRefs(String refType) { return GHRef.readMatching(this, refType); } + /** + * Retrieves all refs that match the given prefix using the matching-refs endpoint. + * This is useful to avoid fetching all available refs. + * + * @param refPrefix + * the ref prefix to match e.g. heads/main or tags/v1 + * @return paged iterable of all refs matching the specified prefix + */ + public PagedIterable listMatchingRefs(String refPrefix) { + return GHRef.readMatchingRefs(this, refPrefix); + } + /** * List releases paged iterable. * diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index db5d892f85..e8d3a5ddca 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -1090,6 +1090,35 @@ public void listRefsHeads() throws Exception { assertThat(refs.get(0).getRef(), equalTo("refs/heads/main")); } + /** + * List matching refs. + * + * @throws Exception + * the exception + */ + @Test + public void listMatchingRefs() throws Exception { + GHRepository repo = getRepository(); + List refs; + + // Test listing refs matching a prefix + refs = repo.listMatchingRefs("heads").toList(); + assertThat(refs, notNullValue()); + assertThat(refs.size(), greaterThan(3)); + assertThat(refs.get(0).getRef(), equalTo("refs/heads/changes")); + + // Test with refs/ prefix + List refsWithPrefix = repo.listMatchingRefs("refs/heads").toList(); + assertThat(refsWithPrefix.size(), equalTo(refs.size())); + assertThat(refsWithPrefix.get(0).getRef(), equalTo(refs.get(0).getRef())); + + // Test with a more specific prefix + refs = repo.listMatchingRefs("heads/gh").toList(); + assertThat(refs, notNullValue()); + assertThat(refs.size(), equalTo(1)); + assertThat(refs.get(0).getRef(), equalTo("refs/heads/gh-pages")); + } + /** * List releases. * diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/1-user.json new file mode 100644 index 0000000000..0b94fe45e9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/1-user.json @@ -0,0 +1,13 @@ +{ + "id": "1a78e64a-129b-473f-bdd1-f7f5471cc2a8", + "name": "user", + "request": { + "url": "/user", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json" + }, + "persistent": true +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/4-r_h_g_git_matching-refs_heads.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/4-r_h_g_git_matching-refs_heads.json new file mode 100644 index 0000000000..945c594089 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/4-r_h_g_git_matching-refs_heads.json @@ -0,0 +1,13 @@ +{ + "id": "4a78e64a-129b-473f-bdd1-f7f5471cc2a8", + "name": "repos_hub4j-test-org_github-api_git_matching-refs_heads", + "request": { + "url": "/repos/hub4j-test-org/github-api/git/matching-refs/heads", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "4-r_h_g_git_refs_heads.json" + }, + "persistent": true +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/5-r_h_g_git_matching-refs_refs_heads.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/5-r_h_g_git_matching-refs_refs_heads.json new file mode 100644 index 0000000000..8a284e2db0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/5-r_h_g_git_matching-refs_refs_heads.json @@ -0,0 +1,13 @@ +{ + "id": "5a78e64a-129b-473f-bdd1-f7f5471cc2a8", + "name": "repos_hub4j-test-org_github-api_git_matching-refs_refs_heads", + "request": { + "url": "/repos/hub4j-test-org/github-api/git/matching-refs/refs/heads", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "5-r_h_g_git_refs_heads.json" + }, + "persistent": true +} From 4501800f6d17da842c87235f6dd3930e2502af06 Mon Sep 17 00:00:00 2001 From: rball11 Date: Wed, 11 Feb 2026 14:40:02 -0700 Subject: [PATCH 2/4] feat: Added matching-ref API. [2155](https://github.com/hub4j/github-api/issues/2155) --- .../java/org/kohsuke/github/GHRepository.java | 24 ++++---- .../org/kohsuke/github/GHRepositoryTest.java | 57 ++++++++++--------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index e80efcc7d6..06009afe50 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -2800,6 +2800,18 @@ public Map listLanguages() throws IOException { return result; } + /** + * Retrieves all refs that match the given prefix using the matching-refs endpoint. + * This is useful to avoid fetching all available refs. + * + * @param refPrefix + * the ref prefix to match e.g. heads/main or tags/v1 + * @return paged iterable of all refs matching the specified prefix + */ + public PagedIterable listMatchingRefs(String refPrefix) { + return GHRef.readMatchingRefs(this, refPrefix); + } + /** * Lists up all the milestones in this repository. * @@ -2868,18 +2880,6 @@ public PagedIterable listRefs(String refType) { return GHRef.readMatching(this, refType); } - /** - * Retrieves all refs that match the given prefix using the matching-refs endpoint. - * This is useful to avoid fetching all available refs. - * - * @param refPrefix - * the ref prefix to match e.g. heads/main or tags/v1 - * @return paged iterable of all refs matching the specified prefix - */ - public PagedIterable listMatchingRefs(String refPrefix) { - return GHRef.readMatchingRefs(this, refPrefix); - } - /** * List releases paged iterable. * diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index e8d3a5ddca..60ef5e1720 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -1009,6 +1009,35 @@ public void listLanguages() throws IOException { assertThat(languages.get("Java"), greaterThan(100000L)); } + /** + * List matching refs. + * + * @throws Exception + * the exception + */ + @Test + public void listMatchingRefs() throws Exception { + GHRepository repo = getRepository(); + List refs; + + // Test listing refs matching a prefix + refs = repo.listMatchingRefs("heads").toList(); + assertThat(refs, notNullValue()); + assertThat(refs.size(), greaterThan(3)); + assertThat(refs.get(0).getRef(), equalTo("refs/heads/changes")); + + // Test with refs/ prefix + List refsWithPrefix = repo.listMatchingRefs("refs/heads").toList(); + assertThat(refsWithPrefix.size(), equalTo(refs.size())); + assertThat(refsWithPrefix.get(0).getRef(), equalTo(refs.get(0).getRef())); + + // Test with a more specific prefix + refs = repo.listMatchingRefs("heads/gh").toList(); + assertThat(refs, notNullValue()); + assertThat(refs.size(), equalTo(1)); + assertThat(refs.get(0).getRef(), equalTo("refs/heads/gh-pages")); + } + /** * List refs. * @@ -1090,34 +1119,6 @@ public void listRefsHeads() throws Exception { assertThat(refs.get(0).getRef(), equalTo("refs/heads/main")); } - /** - * List matching refs. - * - * @throws Exception - * the exception - */ - @Test - public void listMatchingRefs() throws Exception { - GHRepository repo = getRepository(); - List refs; - - // Test listing refs matching a prefix - refs = repo.listMatchingRefs("heads").toList(); - assertThat(refs, notNullValue()); - assertThat(refs.size(), greaterThan(3)); - assertThat(refs.get(0).getRef(), equalTo("refs/heads/changes")); - - // Test with refs/ prefix - List refsWithPrefix = repo.listMatchingRefs("refs/heads").toList(); - assertThat(refsWithPrefix.size(), equalTo(refs.size())); - assertThat(refsWithPrefix.get(0).getRef(), equalTo(refs.get(0).getRef())); - - // Test with a more specific prefix - refs = repo.listMatchingRefs("heads/gh").toList(); - assertThat(refs, notNullValue()); - assertThat(refs.size(), equalTo(1)); - assertThat(refs.get(0).getRef(), equalTo("refs/heads/gh-pages")); - } /** * List releases. From 5cd052fc8bba7f839a92f41f89965e3311505821 Mon Sep 17 00:00:00 2001 From: rball11 Date: Wed, 11 Feb 2026 14:49:34 -0700 Subject: [PATCH 3/4] feat: Added matching-ref API. [2155](https://github.com/hub4j/github-api/issues/2155) --- src/main/java/org/kohsuke/github/GHRepository.java | 4 ++-- src/test/java/org/kohsuke/github/GHRepositoryTest.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 06009afe50..9ddfe65cfe 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -2801,8 +2801,8 @@ public Map listLanguages() throws IOException { } /** - * Retrieves all refs that match the given prefix using the matching-refs endpoint. - * This is useful to avoid fetching all available refs. + * Retrieves all refs that match the given prefix using the matching-refs endpoint. This is useful to avoid fetching + * all available refs. * * @param refPrefix * the ref prefix to match e.g. heads/main or tags/v1 diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index 60ef5e1720..ae8fba9ba7 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -1119,7 +1119,6 @@ public void listRefsHeads() throws Exception { assertThat(refs.get(0).getRef(), equalTo("refs/heads/main")); } - /** * List releases. * From ee0d2271e01061491d91f1c4549bed2be363a07c Mon Sep 17 00:00:00 2001 From: rball11 Date: Wed, 11 Feb 2026 15:01:27 -0700 Subject: [PATCH 4/4] feat: Added matching-ref API. [2155](https://github.com/hub4j/github-api/issues/2155) --- .../listMatchingRefs/__files/1-user.json | 45 +++ .../__files/2-orgs_hub4j-test-org.json | 41 +++ .../__files/3-r_h_github-api.json | 332 ++++++++++++++++++ .../__files/4-r_h_g_git_refs_heads.json | 102 ++++++ .../__files/5-r_h_g_git_refs_heads.json | 102 ++++++ .../__files/7-r_h_g_git_refs_heads_gh.json | 12 + .../mappings/2-orgs_hub4j-test-org.json | 42 +++ .../mappings/3-r_h_github-api.json | 47 +++ .../6-r_h_g_git_matching-refs_heads_gh.json | 13 + 9 files changed, 736 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/3-r_h_github-api.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/4-r_h_g_git_refs_heads.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/5-r_h_g_git_refs_heads.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/7-r_h_g_git_refs_heads_gh.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/3-r_h_github-api.json create mode 100644 src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/6-r_h_g_git_matching-refs_heads_gh.json diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/1-user.json new file mode 100644 index 0000000000..e4fc4d8657 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 183, + "public_gists": 7, + "followers": 159, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-05-20T16:02:42Z", + "private_gists": 19, + "total_private_repos": 12, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..e079133f20 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-05-15T15:14:14Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 148, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 17, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/3-r_h_github-api.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/3-r_h_github-api.json new file mode 100644 index 0000000000..aadbbf12ef --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/3-r_h_github-api.json @@ -0,0 +1,332 @@ +{ + "id": 206888201, + "node_id": "MDEwOlJlcG9zaXRvcnkyMDY4ODgyMDE=", + "name": "github-api", + "full_name": "hub4j-test-org/github-api", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/github-api", + "description": "Tricky", + "fork": true, + "url": "https://api.github.com/repos/hub4j-test-org/github-api", + "forks_url": "https://api.github.com/repos/hub4j-test-org/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api/deployments", + "created_at": "2019-09-06T23:26:04Z", + "updated_at": "2020-01-16T21:22:56Z", + "pushed_at": "2020-05-20T16:22:43Z", + "git_url": "git://github.com/hub4j-test-org/github-api.git", + "ssh_url": "git@github.com:hub4j-test-org/github-api.git", + "clone_url": "https://github.com/hub4j-test-org/github-api.git", + "svn_url": "https://github.com/hub4j-test-org/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 19035, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 5, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 0, + "open_issues": 5, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "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}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2020-05-20T22:54:46Z", + "pushed_at": "2020-05-20T20:24:04Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "https://github-api.kohsuke.org/", + "size": 23100, + "stargazers_count": 656, + "watchers_count": 656, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 478, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 67, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 478, + "open_issues": 67, + "watchers": 656, + "default_branch": "main" + }, + "source": { + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "hub4j/github-api", + "private": false, + "owner": { + "login": "hub4j", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j", + "html_url": "https://github.com/hub4j", + "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}", + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "repos_url": "https://api.github.com/users/hub4j/repos", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/hub4j/github-api", + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2020-05-20T22:54:46Z", + "pushed_at": "2020-05-20T20:24:04Z", + "git_url": "git://github.com/hub4j/github-api.git", + "ssh_url": "git@github.com:hub4j/github-api.git", + "clone_url": "https://github.com/hub4j/github-api.git", + "svn_url": "https://github.com/hub4j/github-api", + "homepage": "https://github-api.kohsuke.org/", + "size": 23100, + "stargazers_count": 656, + "watchers_count": 656, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 478, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 67, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 478, + "open_issues": 67, + "watchers": 656, + "default_branch": "main" + }, + "network_count": 478, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/4-r_h_g_git_refs_heads.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/4-r_h_g_git_refs_heads.json new file mode 100644 index 0000000000..87cfc4734a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/4-r_h_g_git_refs_heads.json @@ -0,0 +1,102 @@ +[ + { + "ref": "refs/heads/changes", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvY2hhbmdlcw==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/changes", + "object": { + "sha": "1393706f1364742defbc28ba459082630ca979af", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/1393706f1364742defbc28ba459082630ca979af" + } + }, + { + "ref": "refs/heads/gh-pages", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvZ2gtcGFnZXM=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/gh-pages", + "object": { + "sha": "4e64a0f9c3d561ab8587d2f7b03074b8745b5943", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/4e64a0f9c3d561ab8587d2f7b03074b8745b5943" + } + }, + { + "ref": "refs/heads/main", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvbWFzdGVy", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/main", + "object": { + "sha": "8051615eff597f4e49f4f47625e6fc2b49f26bfc", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/8051615eff597f4e49f4f47625e6fc2b49f26bfc" + } + }, + { + "ref": "refs/heads/test/#UrlEncode", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC8jVXJsRW5jb2Rl", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/%23UrlEncode", + "object": { + "sha": "14fa3698221f91613b9e1d809434326e5ed546af", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/14fa3698221f91613b9e1d809434326e5ed546af" + } + }, + { + "ref": "refs/heads/test/mergeable_branch", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9tZXJnZWFibGVfYnJhbmNo", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/mergeable_branch", + "object": { + "sha": "b036909fcf45565c82c888ee326ebd0e382f6173", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/b036909fcf45565c82c888ee326ebd0e382f6173" + } + }, + { + "ref": "refs/heads/test/rc", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9yYw==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/rc", + "object": { + "sha": "14fa3698221f91613b9e1d809434326e5ed546af", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/14fa3698221f91613b9e1d809434326e5ed546af" + } + }, + { + "ref": "refs/heads/test/squashMerge", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9zcXVhc2hNZXJnZQ==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/squashMerge", + "object": { + "sha": "80902706c65747f9d8a7dbf82c451658efe2516d", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/80902706c65747f9d8a7dbf82c451658efe2516d" + } + }, + { + "ref": "refs/heads/test/stable", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9zdGFibGU=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/stable", + "object": { + "sha": "1f40fdf4acf1adb246c109c21a22f617e4bd1ca8", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/1f40fdf4acf1adb246c109c21a22f617e4bd1ca8" + } + }, + { + "ref": "refs/heads/test/unmergeable", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC91bm1lcmdlYWJsZQ==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/unmergeable", + "object": { + "sha": "d4080cf9e2fa0959966d201f3dd60105fdf5bd97", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/d4080cf9e2fa0959966d201f3dd60105fdf5bd97" + } + }, + { + "ref": "refs/heads/test/updateContentSquashMerge", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC91cGRhdGVDb250ZW50U3F1YXNoTWVyZ2U=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/updateContentSquashMerge", + "object": { + "sha": "36526be0a94e2d315c30379c7a561b1f7125a35f", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/36526be0a94e2d315c30379c7a561b1f7125a35f" + } + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/5-r_h_g_git_refs_heads.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/5-r_h_g_git_refs_heads.json new file mode 100644 index 0000000000..87cfc4734a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/5-r_h_g_git_refs_heads.json @@ -0,0 +1,102 @@ +[ + { + "ref": "refs/heads/changes", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvY2hhbmdlcw==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/changes", + "object": { + "sha": "1393706f1364742defbc28ba459082630ca979af", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/1393706f1364742defbc28ba459082630ca979af" + } + }, + { + "ref": "refs/heads/gh-pages", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvZ2gtcGFnZXM=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/gh-pages", + "object": { + "sha": "4e64a0f9c3d561ab8587d2f7b03074b8745b5943", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/4e64a0f9c3d561ab8587d2f7b03074b8745b5943" + } + }, + { + "ref": "refs/heads/main", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvbWFzdGVy", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/main", + "object": { + "sha": "8051615eff597f4e49f4f47625e6fc2b49f26bfc", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/8051615eff597f4e49f4f47625e6fc2b49f26bfc" + } + }, + { + "ref": "refs/heads/test/#UrlEncode", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC8jVXJsRW5jb2Rl", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/%23UrlEncode", + "object": { + "sha": "14fa3698221f91613b9e1d809434326e5ed546af", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/14fa3698221f91613b9e1d809434326e5ed546af" + } + }, + { + "ref": "refs/heads/test/mergeable_branch", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9tZXJnZWFibGVfYnJhbmNo", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/mergeable_branch", + "object": { + "sha": "b036909fcf45565c82c888ee326ebd0e382f6173", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/b036909fcf45565c82c888ee326ebd0e382f6173" + } + }, + { + "ref": "refs/heads/test/rc", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9yYw==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/rc", + "object": { + "sha": "14fa3698221f91613b9e1d809434326e5ed546af", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/14fa3698221f91613b9e1d809434326e5ed546af" + } + }, + { + "ref": "refs/heads/test/squashMerge", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9zcXVhc2hNZXJnZQ==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/squashMerge", + "object": { + "sha": "80902706c65747f9d8a7dbf82c451658efe2516d", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/80902706c65747f9d8a7dbf82c451658efe2516d" + } + }, + { + "ref": "refs/heads/test/stable", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC9zdGFibGU=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/stable", + "object": { + "sha": "1f40fdf4acf1adb246c109c21a22f617e4bd1ca8", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/1f40fdf4acf1adb246c109c21a22f617e4bd1ca8" + } + }, + { + "ref": "refs/heads/test/unmergeable", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC91bm1lcmdlYWJsZQ==", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/unmergeable", + "object": { + "sha": "d4080cf9e2fa0959966d201f3dd60105fdf5bd97", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/d4080cf9e2fa0959966d201f3dd60105fdf5bd97" + } + }, + { + "ref": "refs/heads/test/updateContentSquashMerge", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvdGVzdC91cGRhdGVDb250ZW50U3F1YXNoTWVyZ2U=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/test/updateContentSquashMerge", + "object": { + "sha": "36526be0a94e2d315c30379c7a561b1f7125a35f", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/36526be0a94e2d315c30379c7a561b1f7125a35f" + } + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/7-r_h_g_git_refs_heads_gh.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/7-r_h_g_git_refs_heads_gh.json new file mode 100644 index 0000000000..a63324fb61 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/__files/7-r_h_g_git_refs_heads_gh.json @@ -0,0 +1,12 @@ +[ + { + "ref": "refs/heads/gh-pages", + "node_id": "MDM6UmVmMjA2ODg4MjAxOnJlZnMvaGVhZHMvZ2gtcGFnZXM=", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs/heads/gh-pages", + "object": { + "sha": "4e64a0f9c3d561ab8587d2f7b03074b8745b5943", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits/4e64a0f9c3d561ab8587d2f7b03074b8745b5943" + } + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..87109f09c4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,42 @@ +{ + "id": "e7d412e7-52ee-4820-9a7b-f03438e032fb", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Thu, 21 May 2020 00:01:19 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4927", + "X-RateLimit-Reset": "1590020149", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"de5da0827fbd925dd0dde9d2d6a85f45\"", + "Last-Modified": "Fri, 15 May 2020 15:14:14 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F020:533D:1B062:214B3:5EC5C4CE" + } + }, + "uuid": "e7d412e7-52ee-4820-9a7b-f03438e032fb", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/3-r_h_github-api.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/3-r_h_github-api.json new file mode 100644 index 0000000000..ee46968581 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/3-r_h_github-api.json @@ -0,0 +1,47 @@ +{ + "id": "2566ff9b-e3b9-4819-9103-74a9c8d67bc0", + "name": "repos_hub4j-test-org_github-api", + "request": { + "url": "/repos/hub4j-test-org/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_github-api.json", + "headers": { + "Date": "Thu, 21 May 2020 00:01:19 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4926", + "X-RateLimit-Reset": "1590020148", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"312e4c361c7730b8cbae6f074a82248e\"", + "Last-Modified": "Thu, 16 Jan 2020 21:22:56 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F020:533D:1B065:214B6:5EC5C4CF" + } + }, + "uuid": "2566ff9b-e3b9-4819-9103-74a9c8d67bc0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/6-r_h_g_git_matching-refs_heads_gh.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/6-r_h_g_git_matching-refs_heads_gh.json new file mode 100644 index 0000000000..135dc7f6c5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listMatchingRefs/mappings/6-r_h_g_git_matching-refs_heads_gh.json @@ -0,0 +1,13 @@ +{ + "id": "6a78e64a-129b-473f-bdd1-f7f5471cc2a8", + "name": "repos_hub4j-test-org_github-api_git_matching-refs_heads_gh", + "request": { + "url": "/repos/hub4j-test-org/github-api/git/matching-refs/heads/gh", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "7-r_h_g_git_refs_heads_gh.json" + }, + "persistent": true +}