Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include triggering actor in workflow run #2006

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/org/kohsuke/github/GHWorkflowRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public GHWorkflowRun() {

private long runAttempt;
private String runStartedAt;
private GHUser triggeringActor;

private String htmlUrl;
private String jobsUrl;
Expand Down Expand Up @@ -119,6 +120,16 @@ public Date getRunStartedAt() throws IOException {
return GitHubClient.parseDate(runStartedAt);
}

/**
* The actor which triggered the run.
*
* @return the triggering actor
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public GHUser getTriggeringActor() {
return triggeringActor;
}

/**
* Gets the html url.
*
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void testManualRunAndBasicInformation() throws IOException {
assertThat(workflowRun.getStatus(), equalTo(Status.COMPLETED));
assertThat(workflowRun.getConclusion(), equalTo(Conclusion.SUCCESS));
assertThat(workflowRun.getHeadSha(), notNullValue());
assertThat(workflowRun.getTriggeringActor(), hasProperty("login", equalTo("octocat")));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@
"cancel_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/686034992/cancel",
"rerun_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/runs/686034992/rerun",
"workflow_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/actions/workflows/6820790",
"triggering_actor": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"head_commit": {
"id": "f6a5c19a67797d64426203b8a7a05a0fd74e5037",
"tree_id": "666bb9f951306171acb21632eca28a386cb35f73",
Expand Down
Loading