Skip to content

Commit

Permalink
Include triggering actor in workflow run
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrDerb committed Jan 8, 2025
1 parent c8f4815 commit e81a6f2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
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 GHPerson 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

0 comments on commit e81a6f2

Please sign in to comment.