From 4d14405dde988a0497bae7a2d58b93d0a105e129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serkan=20=C3=96ZAL?= Date: Sat, 25 Sep 2021 08:42:13 +0300 Subject: [PATCH] Added `list-workflow-runs` API --- .../org/kohsuke/github/GHOrganization.java | 2 + .../java/org/kohsuke/github/GHWorkflow.java | 9 + .../github/GHWorkflowRunQueryBuilder.java | 8 +- .../github/GHWorkflowRunsIterable.java | 9 +- .../org/kohsuke/github/GHWorkflowTest.java | 42 +++- ...repos_hub4j-test-org_ghworkflowtest-2.json | 126 ++++++++++++ ...ghworkflowtest_actions_workflowruns-4.json | 179 ++++++++++++++++++ ...ghworkflowtest_actions_workflowruns-5.json | 179 ++++++++++++++++++ ..._actions_workflows_test-workflowyml-3.json | 12 ++ .../testListWorkflowRuns/__files/user-1.json | 46 +++++ ...repos_hub4j-test-org_ghworkflowtest-2.json | 46 +++++ ...test_actions_workflows_6817859_runs-4.json | 46 +++++ ...test_actions_workflows_6817859_runs-5.json | 45 +++++ ..._actions_workflows_test-workflowyml-3.json | 45 +++++ .../testListWorkflowRuns/mappings/user-1.json | 46 +++++ 15 files changed, 830 insertions(+), 10 deletions(-) create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/user-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/user-1.json diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index a3c6adb6f6..d690285706 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -644,7 +644,9 @@ public GHHook getHook(int id) throws IOException { * Deletes hook. * * @param id + * the id * @throws IOException + * the io exception */ public void deleteHook(int id) throws IOException { GHHooks.orgContext(this).deleteHook(id); diff --git a/src/main/java/org/kohsuke/github/GHWorkflow.java b/src/main/java/org/kohsuke/github/GHWorkflow.java index 3fca9c936b..ea195e5b10 100644 --- a/src/main/java/org/kohsuke/github/GHWorkflow.java +++ b/src/main/java/org/kohsuke/github/GHWorkflow.java @@ -136,6 +136,15 @@ public void dispatch(String ref, Map inputs) throws IOException requester.fetchHttpStatusCode(); } + /** + * Lists the workflow runs belong to this workflow. + * + * @return the paged iterable + */ + public PagedIterable listRuns() { + return new GHWorkflowRunsIterable(owner, root().createRequest().withUrlPath(getApiRoute(), "runs")); + } + private String getApiRoute() { if (owner == null) { // Workflow runs returned from search to do not have an owner. Attempt to use url. diff --git a/src/main/java/org/kohsuke/github/GHWorkflowRunQueryBuilder.java b/src/main/java/org/kohsuke/github/GHWorkflowRunQueryBuilder.java index 2529d0198e..57a482d1bf 100644 --- a/src/main/java/org/kohsuke/github/GHWorkflowRunQueryBuilder.java +++ b/src/main/java/org/kohsuke/github/GHWorkflowRunQueryBuilder.java @@ -2,8 +2,6 @@ import org.kohsuke.github.GHWorkflowRun.Status; -import java.net.MalformedURLException; - /** * Lists up workflow runs with some filtering and sorting. * @@ -92,10 +90,6 @@ public GHWorkflowRunQueryBuilder status(Status status) { @Override public PagedIterable list() { - try { - return new GHWorkflowRunsIterable(repo, req.withUrlPath(repo.getApiTailUrl("actions/runs")).build()); - } catch (MalformedURLException e) { - throw new GHException(e.getMessage(), e); - } + return new GHWorkflowRunsIterable(repo, req.withUrlPath(repo.getApiTailUrl("actions/runs"))); } } diff --git a/src/main/java/org/kohsuke/github/GHWorkflowRunsIterable.java b/src/main/java/org/kohsuke/github/GHWorkflowRunsIterable.java index bbc2d0bbae..cf2f011636 100644 --- a/src/main/java/org/kohsuke/github/GHWorkflowRunsIterable.java +++ b/src/main/java/org/kohsuke/github/GHWorkflowRunsIterable.java @@ -1,5 +1,6 @@ package org.kohsuke.github; +import java.net.MalformedURLException; import java.util.Iterator; import javax.annotation.Nonnull; @@ -13,9 +14,13 @@ class GHWorkflowRunsIterable extends PagedIterable { private GHWorkflowRunsPage result; - public GHWorkflowRunsIterable(GHRepository owner, GitHubRequest request) { + public GHWorkflowRunsIterable(GHRepository owner, GitHubRequest.Builder requestBuilder) { this.owner = owner; - this.request = request; + try { + this.request = requestBuilder.build(); + } catch (MalformedURLException e) { + throw new GHException("Malformed URL", e); + } } @Nonnull diff --git a/src/test/java/org/kohsuke/github/GHWorkflowTest.java b/src/test/java/org/kohsuke/github/GHWorkflowTest.java index a08d9bb342..a91f9f4ca9 100644 --- a/src/test/java/org/kohsuke/github/GHWorkflowTest.java +++ b/src/test/java/org/kohsuke/github/GHWorkflowTest.java @@ -12,7 +12,8 @@ import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.verify; -import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.notNullValue; public class GHWorkflowTest extends AbstractGitHubWireMockTest { @@ -108,4 +109,43 @@ public void testListWorkflows() throws IOException { assertThat(workflow.getBadgeUrl().getPath(), equalTo("/hub4j-test-org/GHWorkflowTest/workflows/test-workflow/badge.svg")); } + + @Test + public void testListWorkflowRuns() throws IOException { + GHWorkflow workflow = repo.getWorkflow("test-workflow.yml"); + + List workflowRuns = workflow.listRuns().toList(); + assertThat(workflowRuns.size(), is(2)); + + checkWorkflowRunProperties(workflowRuns.get(0), workflow.getId()); + checkWorkflowRunProperties(workflowRuns.get(1), workflow.getId()); + } + + private static void checkWorkflowRunProperties(GHWorkflowRun workflowRun, long workflowId) throws IOException { + assertThat(workflowRun.getWorkflowId(), equalTo(workflowId)); + assertThat(workflowRun.getId(), notNullValue()); + assertThat(workflowRun.getNodeId(), notNullValue()); + assertThat(workflowRun.getRepository().getFullName(), equalTo(REPO_NAME)); + assertThat(workflowRun.getUrl().getPath(), containsString("/actions/runs/")); + assertThat(workflowRun.getHtmlUrl().getPath(), containsString("/actions/runs/")); + assertThat(workflowRun.getJobsUrl().getPath(), endsWith("/jobs")); + assertThat(workflowRun.getLogsUrl().getPath(), endsWith("/logs")); + assertThat(workflowRun.getCheckSuiteUrl().getPath(), containsString("/check-suites/")); + assertThat(workflowRun.getArtifactsUrl().getPath(), endsWith("/artifacts")); + assertThat(workflowRun.getCancelUrl().getPath(), endsWith("/cancel")); + assertThat(workflowRun.getRerunUrl().getPath(), endsWith("/rerun")); + assertThat(workflowRun.getWorkflowUrl().getPath(), containsString("/actions/workflows/")); + assertThat(workflowRun.getHeadBranch(), equalTo("main")); + assertThat(workflowRun.getHeadCommit().getId(), notNullValue()); + assertThat(workflowRun.getHeadCommit().getTreeId(), notNullValue()); + assertThat(workflowRun.getHeadCommit().getMessage(), notNullValue()); + assertThat(workflowRun.getHeadCommit().getTimestamp(), notNullValue()); + assertThat(workflowRun.getHeadCommit().getAuthor().getEmail(), notNullValue()); + assertThat(workflowRun.getHeadCommit().getCommitter().getEmail(), notNullValue()); + assertThat(workflowRun.getEvent(), equalTo(GHEvent.WORKFLOW_DISPATCH)); + assertThat(workflowRun.getStatus(), equalTo(GHWorkflowRun.Status.COMPLETED)); + assertThat(workflowRun.getConclusion(), equalTo(GHWorkflowRun.Conclusion.SUCCESS)); + assertThat(workflowRun.getHeadSha(), notNullValue()); + } + } diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest-2.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest-2.json new file mode 100644 index 0000000000..c984c8be47 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest-2.json @@ -0,0 +1,126 @@ +{ + "id": 348651606, + "node_id": "MDEwOlJlcG9zaXRvcnkzNDg2NTE2MDY=", + "name": "GHWorkflowTest", + "full_name": "hub4j-test-org/GHWorkflowTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.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/GHWorkflowTest", + "description": "Repository used for GHWorkflowTest", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/deployments", + "created_at": "2021-03-17T09:32:03Z", + "updated_at": "2021-03-17T09:33:34Z", + "pushed_at": "2021-03-17T09:33:32Z", + "git_url": "git://github.com/hub4j-test-org/GHWorkflowTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHWorkflowTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHWorkflowTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHWorkflowTest", + "homepage": null, + "size": 1, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "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": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "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://avatars.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 + }, + "network_count": 0, + "subscribers_count": 10 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-4.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-4.json new file mode 100644 index 0000000000..61bd2c1216 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-4.json @@ -0,0 +1,179 @@ +{ + "total_count": 2, + "workflow_runs": [ + { + "id": 712243851, + "name": "Test workflow", + "node_id": "MDExOldvcmtmbG93UnVuNzEyMjQzODUx", + "head_branch": "main", + "head_sha": "40fdaab83052625585482a86769a73e317f6e7c3", + "run_number": 10, + "event": "workflow_dispatch", + "status": "completed", + "conclusion": "success", + "workflow_id": 6817859, + "check_suite_id": 2408679180, + "check_suite_node_id": "MDEwOkNoZWNrU3VpdGUyNDA4Njc5MTgw", + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851", + "html_url": "https://github.com/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851", + "pull_requests": [], + "created_at": "2021-04-02T16:54:16Z", + "updated_at": "2021-04-02T16:54:32Z", + "jobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851/jobs", + "logs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851/logs", + "check_suite_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-suites/2408679180", + "artifacts_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851/artifacts", + "cancel_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851/cancel", + "rerun_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712243851/rerun", + "workflow_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/workflows/7433027", + "head_commit": { + "id": "40fdaab83052625585482a86769a73e317f6e7c3", + "tree_id": "1c9feb95826bf56ea972f7cb5a045c8b0a2e19c7", + "message": "Create test-workflow.yml", + "timestamp": "2021-04-02T15:48:51Z", + "author": { + "name": "Guillaume Smet", + "email": "guillaume.smet@gmail.com" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com" + } + }, + "repository": { + "id": 348674220, + "node_id": "MDEwOlJlcG9zaXRvcnkzNDg2NzQyMjA=", + "name": "GHWorkflowRunTest", + "full_name": "hub4j-test-org/GHWorkflowRunTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.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/GHWorkflowRunTest", + "description": "Repository used by GHWorkflowRunTest", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/deployments" + }, + "head_repository": { + "id": 348674220, + "node_id": "MDEwOlJlcG9zaXRvcnkzNDg2NzQyMjA=", + "name": "GHWorkflowRunTest", + "full_name": "hub4j-test-org/GHWorkflowRunTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.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/GHWorkflowRunTest", + "description": "Repository used by GHWorkflowRunTest", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/deployments" + } + } + ] +} diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-5.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-5.json new file mode 100644 index 0000000000..02fd235fcf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-5.json @@ -0,0 +1,179 @@ +{ + "total_count": 2, + "workflow_runs": [ + { + "id": 712241595, + "name": "Test workflow", + "node_id": "MDExOldvcmtmbG93UnVuNzEyMjQxNTk1", + "head_branch": "main", + "head_sha": "40fdaab83052625585482a86769a73e317f6e7c3", + "run_number": 9, + "event": "workflow_dispatch", + "status": "completed", + "conclusion": "success", + "workflow_id": 6817859, + "check_suite_id": 2408673964, + "check_suite_node_id": "MDEwOkNoZWNrU3VpdGUyNDA4NjczOTY0", + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595", + "html_url": "https://github.com/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595", + "pull_requests": [], + "created_at": "2021-04-02T16:53:18Z", + "updated_at": "2021-04-02T16:53:33Z", + "jobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595/jobs", + "logs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595/logs", + "check_suite_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-suites/2408673964", + "artifacts_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595/artifacts", + "cancel_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595/cancel", + "rerun_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/712241595/rerun", + "workflow_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/workflows/7433027", + "head_commit": { + "id": "40fdaab83052625585482a86769a73e317f6e7c3", + "tree_id": "1c9feb95826bf56ea972f7cb5a045c8b0a2e19c7", + "message": "Create test-workflow.yml", + "timestamp": "2021-04-02T15:48:51Z", + "author": { + "name": "Guillaume Smet", + "email": "guillaume.smet@gmail.com" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com" + } + }, + "repository": { + "id": 348674220, + "node_id": "MDEwOlJlcG9zaXRvcnkzNDg2NzQyMjA=", + "name": "GHWorkflowRunTest", + "full_name": "hub4j-test-org/GHWorkflowRunTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.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/GHWorkflowRunTest", + "description": "Repository used by GHWorkflowRunTest", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/deployments" + }, + "head_repository": { + "id": 348674220, + "node_id": "MDEwOlJlcG9zaXRvcnkzNDg2NzQyMjA=", + "name": "GHWorkflowRunTest", + "full_name": "hub4j-test-org/GHWorkflowRunTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.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/GHWorkflowRunTest", + "description": "Repository used by GHWorkflowRunTest", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/deployments" + } + } + ] +} diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json new file mode 100644 index 0000000000..c40633b49f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json @@ -0,0 +1,12 @@ +{ + "id": 6817859, + "node_id": "MDg6V29ya2Zsb3c2ODE3ODU5", + "name": "test-workflow", + "path": ".github/workflows/test-workflow.yml", + "state": "active", + "created_at": "2021-03-17T10:33:32.000+01:00", + "updated_at": "2021-03-25T11:36:24.000+01:00", + "url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859", + "html_url": "https://github.com/hub4j-test-org/GHWorkflowTest/blob/main/.github/workflows/test-workflow.yml", + "badge_url": "https://github.com/hub4j-test-org/GHWorkflowTest/workflows/test-workflow/badge.svg" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/user-1.json new file mode 100644 index 0000000000..79bade964e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/__files/user-1.json @@ -0,0 +1,46 @@ +{ + "login": "gsmet", + "id": 1279749, + "node_id": "MDQ6VXNlcjEyNzk3NDk=", + "avatar_url": "https://avatars.githubusercontent.com/u/1279749?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gsmet", + "html_url": "https://github.com/gsmet", + "followers_url": "https://api.github.com/users/gsmet/followers", + "following_url": "https://api.github.com/users/gsmet/following{/other_user}", + "gists_url": "https://api.github.com/users/gsmet/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gsmet/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gsmet/subscriptions", + "organizations_url": "https://api.github.com/users/gsmet/orgs", + "repos_url": "https://api.github.com/users/gsmet/repos", + "events_url": "https://api.github.com/users/gsmet/events{/privacy}", + "received_events_url": "https://api.github.com/users/gsmet/received_events", + "type": "User", + "site_admin": false, + "name": "Guillaume Smet", + "company": "Red Hat", + "blog": "https://www.redhat.com/", + "location": "Lyon, France", + "email": "guillaume.smet@gmail.com", + "hireable": null, + "bio": "Happy camper at Red Hat, working on Quarkus and the Hibernate portfolio.", + "twitter_username": "gsmet_", + "public_repos": 102, + "public_gists": 14, + "followers": 127, + "following": 3, + "created_at": "2011-12-22T11:03:22Z", + "updated_at": "2021-03-23T17:35:45Z", + "private_gists": 14, + "total_private_repos": 4, + "owned_private_repos": 1, + "disk_usage": 68258, + "collaborators": 1, + "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/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest-2.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest-2.json new file mode 100644 index 0000000000..0dcb94acfc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest-2.json @@ -0,0 +1,46 @@ +{ + "id": "66e98e06-916e-4c7f-8747-c821f1d58b18", + "name": "repos_hub4j-test-org_ghworkflowtest", + "request": { + "url": "/repos/hub4j-test-org/GHWorkflowTest", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghworkflowtest-2.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 25 Mar 2021 10:36:26 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"082e0c2ae9f1d8387e22ebe7279d627738b78d114a3badc2d9e60dfb0b2a6abf\"", + "Last-Modified": "Wed, 17 Mar 2021 09:33:34 GMT", + "X-OAuth-Scopes": "repo, user, workflow", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1616672182", + "X-RateLimit-Used": "17", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "D59E:13DDE:48774DE:498A32F:605C67A9" + } + }, + "uuid": "66e98e06-916e-4c7f-8747-c821f1d58b18", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-4.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-4.json new file mode 100644 index 0000000000..fc78d31aaf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-4.json @@ -0,0 +1,46 @@ +{ + "id": "a29bc36c-7907-4bbc-9542-a030ae5b8272", + "name": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs", + "request": { + "url": "/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859/runs", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-4.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 02 Apr 2021 16:54:38 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"158233711de1a189843695211dd42ec9898b518437eb5e78447c62c2e993f33e\"", + "X-OAuth-Scopes": "repo, user, workflow", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4863", + "X-RateLimit-Reset": "1617384010", + "X-RateLimit-Used": "137", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "8870:697D:FBE289:10027A5:60674C4E", + "Link": "; rel=\"next\", ; rel=\"last\"" + } + }, + "uuid": "781f4b9d-2477-4ec0-9e8d-32bf5a6fa088", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-5.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-5.json new file mode 100644 index 0000000000..bf50de1adc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs-5.json @@ -0,0 +1,45 @@ +{ + "id": "bb33f7df-9465-4b7d-a865-da34efc59540\n\n", + "name": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_6817859_runs", + "request": { + "url": "/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859/runs?per_page=1&page=2", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflowruns-5.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 02 Apr 2021 16:54:38 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"158233711de1a189843695211dd42ec9898b518437eb5e78447c62c2e993f33e\"", + "X-OAuth-Scopes": "repo, user, workflow", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4863", + "X-RateLimit-Reset": "1617384010", + "X-RateLimit-Used": "137", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "8870:697D:FBE289:10027A5:60674C4E" + } + }, + "uuid": "2b710d23-e9bf-4271-ab8e-7b6b083accc5\n\n", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json new file mode 100644 index 0000000000..ca617d89f1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json @@ -0,0 +1,45 @@ +{ + "id": "78e27ea7-027a-4f97-b770-5308041a2216", + "name": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml", + "request": { + "url": "/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/test-workflow.yml", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghworkflowtest_actions_workflows_test-workflowyml-3.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 25 Mar 2021 10:36:26 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"72a49555d2625ba9f490d619d324726f5192dc2a030dc22033b9cadf7a2ba076\"", + "X-OAuth-Scopes": "repo, user, workflow", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1616672182", + "X-RateLimit-Used": "18", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "D59E:13DDE:4877553:498A3A7:605C67AA" + } + }, + "uuid": "78e27ea7-027a-4f97-b770-5308041a2216", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/user-1.json new file mode 100644 index 0000000000..fb70b2e9fb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHWorkflowTest/wiremock/testListWorkflowRuns/mappings/user-1.json @@ -0,0 +1,46 @@ +{ + "id": "44f1323e-bd63-4f16-b059-b83c47e18e5f", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 25 Mar 2021 10:36:25 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"879f35eed38dcc75ca2b3a8999425e0d51678f4c73ffade3c5bcc853b59245b6\"", + "Last-Modified": "Tue, 23 Mar 2021 17:35:45 GMT", + "X-OAuth-Scopes": "repo, user, workflow", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4987", + "X-RateLimit-Reset": "1616672182", + "X-RateLimit-Used": "13", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "D59E:13DDE:4877368:498A1B8:605C67A9" + } + }, + "uuid": "44f1323e-bd63-4f16-b059-b83c47e18e5f", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file