Repository: hub4j/github-api (java)

Issue:
Missing Workflow Job's running machine type (ubuntu, windows, macos) 
Hello,
I need to find Workflow Job's running machine type (ubuntu, windows, macos). Github Api has labels property which includes that information. It seems like you did not provide **labels** information of GHWorkflowJob. Can you provide that or do you have information about job's running mactine type already? Thank you for your supports...

Pull request description:
Add missing porperties to the GHWorkflowJob.java
# Description

I need to find Workflow Job's running machine type (ubuntu, windows, macos). Github Api has labels property which includes that information. This PR adds labels information to the GHWorkflowJob

Fixes #1445 
# Before submitting a PR:

- [x] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Add JavaDocs and other comments as appropriate. Consider including links in comments to relevant documentation on https://docs.github.com/en/rest .  
- [x] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI.
- [x] Push your changes to a branch other than `main`. You will create your PR from that branch.

# When creating a PR: 

- [x] Fill in the "Description" above with clear summary of the changes. This includes:
  - [x] If this PR fixes one or more issues, include "Fixes #<issue number>" lines for each issue. 
  - [x] Provide links to relevant documentation on https://docs.github.com/en/rest where possible.
- [x] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
- [x] Enable "Allow edits from maintainers".


Patch:
diff --git a/src/main/java/org/kohsuke/github/GHWorkflowJob.java b/src/main/java/org/kohsuke/github/GHWorkflowJob.java
index 767075550..710930e74 100644
--- a/src/main/java/org/kohsuke/github/GHWorkflowJob.java
+++ b/src/main/java/org/kohsuke/github/GHWorkflowJob.java
@@ -9,7 +9,11 @@ import org.kohsuke.github.function.InputStreamFunction;
 
 import java.io.IOException;
 import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 
 import static java.util.Objects.requireNonNull;
 
@@ -40,8 +44,15 @@ public class GHWorkflowJob extends GHObject {
     private String htmlUrl;
     private String checkRunUrl;
 
+    private int runnerId;
+    private String runnerName;
+    private int runnerGroupId;
+    private String runnerGroupName;
+
     private List<Step> steps = new ArrayList<>();
 
+    private List<String> labels = new ArrayList<>();
+
     /**
      * The name of the job.
      *
@@ -141,6 +152,51 @@ public class GHWorkflowJob extends GHObject {
         return Collections.unmodifiableList(steps);
     }
 
+    /**
+     * Gets the labels of the job.
+     *
+     * @return the labels
+     */
+    public List<String> getLabels() {
+        return Collections.unmodifiableList(labels);
+    }
+
+    /**
+     * the runner id.
+     *
+     * @return runnerId
+     */
+    public int getRunnerId() {
+        return runnerId;
+    }
+
+    /**
+     * the runner name.
+     *
+     * @return runnerName
+     */
+    public String getRunnerName() {
+        return runnerName;
+    }
+
+    /**
+     * the runner group id.
+     *
+     * @return runnerGroupId
+     */
+    public int getRunnerGroupId() {
+        return runnerGroupId;
+    }
+
+    /**
+     * the runner group name.
+     *
+     * @return runnerGroupName
+     */
+    public String getRunnerGroupName() {
+        return runnerGroupName;
+    }
+
     /**
      * Repository to which the job belongs.
      *


Test patch:
diff --git a/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java b/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
index d7b544271..402635c54 100644
--- a/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
+++ b/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
@@ -39,6 +39,7 @@ public class GHWorkflowRunTest extends AbstractGitHubWireMockTest {
     private static final String MULTI_JOBS_WORKFLOW_PATH = "multi-jobs-workflow.yml";
     private static final String MULTI_JOBS_WORKFLOW_NAME = "Multi jobs workflow";
     private static final String RUN_A_ONE_LINE_SCRIPT_STEP_NAME = "Run a one-line script";
+    private static final String UBUNTU_LABEL = "ubuntu-latest";
 
     private GHRepository repo;
 
@@ -477,6 +478,10 @@ public class GHWorkflowRunTest extends AbstractGitHubWireMockTest {
         assertThat(job.getUrl().getPath(), containsString("/actions/jobs/"));
         assertThat(job.getHtmlUrl().getPath(), containsString("/runs/" + job.getId()));
         assertThat(job.getCheckRunUrl().getPath(), containsString("/check-runs/"));
+        assertThat(job.getRunnerId(), is(1));
+        assertThat(job.getRunnerName(), containsString("my runner"));
+        assertThat(job.getRunnerGroupId(), is(2));
+        assertThat(job.getRunnerGroupName(), containsString("my runner group"));
 
         // we only test the step we have control over, the others are added by GitHub
         Optional<Step> step = job.getSteps()
@@ -487,6 +492,11 @@ public class GHWorkflowRunTest extends AbstractGitHubWireMockTest {
             fail("Unable to find " + RUN_A_ONE_LINE_SCRIPT_STEP_NAME + " step");
         }
 
+        Optional<String> labelOptional = job.getLabels().stream().filter(s -> s.equals(UBUNTU_LABEL)).findFirst();
+        if (!labelOptional.isPresent()) {
+            fail("Unable to find " + UBUNTU_LABEL + " label");
+        }
+
         checkStepProperties(step.get(), RUN_A_ONE_LINE_SCRIPT_STEP_NAME, 2);
     }
 
diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_jobs__2270858630-10.json b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_jobs__2270858630-10.json
index 915a5db94..6e131628e 100644
--- a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_jobs__2270858630-10.json
+++ b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_jobs__2270858630-10.json
@@ -37,5 +37,12 @@
       "completed_at": "2021-04-05T17:42:59.000+02:00"
     }
   ],
-  "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858630"
+  "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858630",
+  "labels": [
+    "ubuntu-latest"
+  ],
+  "runner_id": 1,
+  "runner_name": "my runner",
+  "runner_group_id": 2,
+  "runner_group_name": "my runner group"
 }
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-11.json b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-11.json
index 9c46949c9..d0c286aa1 100644
--- a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-11.json
+++ b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-11.json
@@ -40,7 +40,14 @@
           "completed_at": "2021-04-05T17:42:57.000+02:00"
         }
       ],
-      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858576"
+      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858576",
+      "labels": [
+        "ubuntu-latest"
+      ],
+      "runner_id": 1,
+      "runner_name": "my runner",
+      "runner_group_id": 2,
+      "runner_group_name": "my runner group"
     },
     {
       "id": 2270858630,
@@ -81,7 +88,14 @@
           "completed_at": "2021-04-05T17:42:59.000+02:00"
         }
       ],
-      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858630"
+      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858630",
+      "labels": [
+        "ubuntu-latest"
+      ],
+      "runner_id": 1,
+      "runner_name": "my runner",
+      "runner_group_id": 2,
+      "runner_group_name": "my runner group"
     }
   ]
 }
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-7.json b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-7.json
index 9c46949c9..d0c286aa1 100644
--- a/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-7.json
+++ b/src/test/resources/org/kohsuke/github/GHWorkflowRunTest/wiremock/testJobs/__files/repos_hub4j-test-org_ghworkflowruntest_actions_runs_719643947_jobs-7.json
@@ -40,7 +40,14 @@
           "completed_at": "2021-04-05T17:42:57.000+02:00"
         }
       ],
-      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858576"
+      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858576",
+      "labels": [
+        "ubuntu-latest"
+      ],
+      "runner_id": 1,
+      "runner_name": "my runner",
+      "runner_group_id": 2,
+      "runner_group_name": "my runner group"
     },
     {
       "id": 2270858630,
@@ -81,7 +88,14 @@
           "completed_at": "2021-04-05T17:42:59.000+02:00"
         }
       ],
-      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858630"
+      "check_run_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/check-runs/2270858630",
+      "labels": [
+        "ubuntu-latest"
+      ],
+      "runner_id": 1,
+      "runner_name": "my runner",
+      "runner_group_id": 2,
+      "runner_group_name": "my runner group"
     }
   ]
 }
\ No newline at end of file