mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Expose repository for artifacts, workflows and workflow runs
This commit is contained in:
@@ -73,6 +73,15 @@ public class GHArtifact extends GHObject {
|
||||
return GitHubClient.parseDate(expiresAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repository to which the artifact belongs.
|
||||
*
|
||||
* @return the repository
|
||||
*/
|
||||
public GHRepository getRepository() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This object has no HTML URL.
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,15 @@ public class GHWorkflow extends GHObject {
|
||||
return GitHubClient.parseURL(htmlUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repository to which the workflow belongs.
|
||||
*
|
||||
* @return the repository
|
||||
*/
|
||||
public GHRepository getRepository() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* The badge URL, like https://github.com/octo-org/octo-repo/workflows/CI/badge.svg
|
||||
*
|
||||
|
||||
@@ -213,6 +213,15 @@ public class GHWorkflowRun extends GHObject {
|
||||
return Conclusion.from(conclusion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repository to which the workflow run belongs.
|
||||
*
|
||||
* @return the repository
|
||||
*/
|
||||
public GHRepository getRepository() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pull requests participated in this workflow run.
|
||||
*
|
||||
|
||||
@@ -62,6 +62,9 @@ public class GHWorkflowRunTest extends AbstractGitHubWireMockTest {
|
||||
() -> new IllegalStateException("We must have a valid workflow run starting from here"));
|
||||
|
||||
assertEquals(workflow.getId(), workflowRun.getWorkflowId());
|
||||
assertNotNull(workflowRun.getId());
|
||||
assertNotNull(workflowRun.getNodeId());
|
||||
assertEquals(REPO_NAME, workflowRun.getRepository().getFullName());
|
||||
assertTrue(workflowRun.getUrl().getPath().contains("/actions/runs/"));
|
||||
assertTrue(workflowRun.getHtmlUrl().getPath().contains("/actions/runs/"));
|
||||
assertTrue(workflowRun.getJobsUrl().getPath().endsWith("/jobs"));
|
||||
@@ -379,6 +382,7 @@ public class GHWorkflowRunTest extends AbstractGitHubWireMockTest {
|
||||
private static void checkArtifactProperties(GHArtifact artifact, String artifactName) throws IOException {
|
||||
assertNotNull(artifact.getId());
|
||||
assertNotNull(artifact.getNodeId());
|
||||
assertEquals(REPO_NAME, artifact.getRepository().getFullName());
|
||||
assertThat(artifact.getName(), is(artifactName));
|
||||
assertThat(artifact.getArchiveDownloadUrl().getPath(), containsString("actions/artifacts"));
|
||||
assertNotNull(artifact.getCreatedAt());
|
||||
|
||||
@@ -43,6 +43,7 @@ public class GHWorkflowTest extends AbstractGitHubWireMockTest {
|
||||
GHWorkflow workflow = repo.getWorkflow("test-workflow.yml");
|
||||
|
||||
assertEquals("test-workflow", workflow.getName());
|
||||
assertEquals(REPO_NAME, workflow.getRepository().getFullName());
|
||||
assertEquals(".github/workflows/test-workflow.yml", workflow.getPath());
|
||||
assertEquals("active", workflow.getState());
|
||||
assertEquals("/repos/hub4j-test-org/GHWorkflowTest/actions/workflows/6817859", workflow.getUrl().getPath());
|
||||
|
||||
Reference in New Issue
Block a user