Repository: hub4j/github-api
Pull request #2100 (2025-05-08 11:14:16)

Add actor to GHWorkflowRun
# Description
Add `actor` to the `GHWorkflowRun` as the current field `triggeringActor` refers to reruns.
See -> https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context



codecov[bot]: ## [Codecov](https://app.codecov.io/gh/hub4j/github-api/pull/2100?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hub4j) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 85.02%. Comparing base [(`362faaf`)](https://app.codecov.io/gh/hub4j/github-api/commit/362faafc50e0bd24d6e93b22131114d1c390fffc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hub4j) to head [(`14e1d62`)](https://app.codecov.io/gh/hub4j/github-api/commit/14e1d626705cf7ea29a4e8ee6a721d808e9b90a2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hub4j).

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff            @@
##               main    #2100   +/-   ##
=========================================
  Coverage     85.01%   85.02%           
- Complexity     2493     2494    +1     
=========================================
  Files           237      237           
  Lines          7349     7350    +1     
  Branches        388      388           
=========================================
+ Hits           6248     6249    +1     
  Misses          871      871           
  Partials        230      230           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/hub4j/github-api/pull/2100?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hub4j).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hub4j).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>

Patch:
diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index 33f089f71..cafd54160 100644
--- a/.github/workflows/maven-build.yml
+++ b/.github/workflows/maven-build.yml
@@ -126,7 +126,7 @@ jobs:
         name: maven-test-target-directory
         path: target
     - name: Codecov Report
-      uses: codecov/codecov-action@v5.4.0
+      uses: codecov/codecov-action@v5.4.3
       with:
         # Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings
         token: ${{ secrets.CODECOV_TOKEN }}
diff --git a/pom.xml b/pom.xml
index 70697ec5f..3d846c444 100644
--- a/pom.xml
+++ b/pom.xml
@@ -475,7 +475,7 @@
       <plugin>
         <groupId>com.diffplug.spotless</groupId>
         <artifactId>spotless-maven-plugin</artifactId>
-        <version>2.44.3</version>
+        <version>2.44.5</version>
         <configuration>
           <java>
             <includes>
diff --git a/src/main/java/org/kohsuke/github/GHWorkflowRun.java b/src/main/java/org/kohsuke/github/GHWorkflowRun.java
index 7e25b29b5..2bf429324 100644
--- a/src/main/java/org/kohsuke/github/GHWorkflowRun.java
+++ b/src/main/java/org/kohsuke/github/GHWorkflowRun.java
@@ -207,6 +207,7 @@ public class GHWorkflowRun extends GHObject {
             return name().toLowerCase(Locale.ROOT);
         }
     }
+    private GHUser actor;
     private String artifactsUrl;
     private String cancelUrl;
     private String checkSuiteUrl;
@@ -307,6 +308,16 @@ public class GHWorkflowRun extends GHObject {
         return root().createRequest().method("GET").withUrlPath(getApiRoute(), "logs").fetchStream(streamFunction);
     }
 
+    /**
+     * The actor which triggered the initial run.
+     *
+     * @return the triggering actor
+     */
+    @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
+    public GHUser getActor() {
+        return actor;
+    }
+
     /**
      * The artifacts URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts
      *


Test patch:
diff --git a/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java b/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
index bacd783ab..960a8e230 100644
--- a/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
+++ b/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
@@ -604,7 +604,8 @@ public class GHWorkflowRunTest extends AbstractGitHubWireMockTest {
         assertThat(workflowRun.getStatus(), equalTo(Status.COMPLETED));
         assertThat(workflowRun.getConclusion(), equalTo(Conclusion.SUCCESS));
         assertThat(workflowRun.getHeadSha(), notNullValue());
-        assertThat(workflowRun.getTriggeringActor(), hasProperty("login", equalTo("octocat")));
+        assertThat(workflowRun.getActor(), hasProperty("login", equalTo("octocat")));
+        assertThat(workflowRun.getTriggeringActor(), hasProperty("login", equalTo("octocat_trigger")));
     }
 
     /**
diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testManualRunAndBasicInformation/__files/6-r_h_g_actions_runs.json b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testManualRunAndBasicInformation/__files/6-r_h_g_actions_runs.json
index 00b4c827d..d2ce37059 100644
--- a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testManualRunAndBasicInformation/__files/6-r_h_g_actions_runs.json
+++ b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testManualRunAndBasicInformation/__files/6-r_h_g_actions_runs.json
@@ -26,7 +26,7 @@
       "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": {
+      "actor": {
         "login": "octocat",
         "id": 1,
         "node_id": "MDQ6VXNlcjE=",
@@ -46,6 +46,26 @@
         "type": "User",
         "site_admin": false
       },
+      "triggering_actor": {
+        "login": "octocat_trigger",
+        "id": 1,
+        "node_id": "MDQ6VXNlcjE=",
+        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+        "gravatar_id": "",
+        "url": "https://api.github.com/users/octocat_trigger",
+        "html_url": "https://github.com/octocat_trigger",
+        "followers_url": "https://api.github.com/users/octocat_trigger/followers",
+        "following_url": "https://api.github.com/users/octocat_trigger/following{/other_user}",
+        "gists_url": "https://api.github.com/users/octocat_trigger/gists{/gist_id}",
+        "starred_url": "https://api.github.com/users/octocat_trigger/starred{/owner}{/repo}",
+        "subscriptions_url": "https://api.github.com/users/octocat_trigger/subscriptions",
+        "organizations_url": "https://api.github.com/users/octocat_trigger/orgs",
+        "repos_url": "https://api.github.com/users/octocat_trigger/repos",
+        "events_url": "https://api.github.com/users/octocat_trigger/events{/privacy}",
+        "received_events_url": "https://api.github.com/users/octocat_trigger/received_events",
+        "type": "User",
+        "site_admin": false
+      },
       "head_commit": {
         "id": "f6a5c19a67797d64426203b8a7a05a0fd74e5037",
         "tree_id": "666bb9f951306171acb21632eca28a386cb35f73",