github-checks-plugin icon indicating copy to clipboard operation
github-checks-plugin copied to clipboard

More descriptive Github checks log message

Open sfc-gh-kbregula opened this issue 8 months ago • 0 comments

What feature do you want to see added?

Currently, the status line that informs that the check is published looks like this:

[GitHub Checks] GitHub check (name: Jenkins, status: completed) has been published.

If the status is completed, it is also worth adding information about the conclusion (one of the values: action_required, cancelled, failure, neutral, success, skipped, stale, timed_out) so log message will be as below:

[GitHub Checks] GitHub check (name: Jenkins, status: completed, conclusion: failure) has been published.

The code responsible for this: https://github.com/jenkinsci/github-checks-plugin/blob/e9ce039f678d13bf665736571b6cca8432c838ba/src/main/java/io/jenkins/plugins/checks/github/GitHubChecksPublisher.java#L99 I have the impression that we just need to change the code as below, but I haven't checked that:

-            buildLogger.log("GitHub check (name: %s, status: %s) has been published.", gitHubDetails.getName(),
-                    gitHubDetails.getStatus());
+            String conclusion = gitHubDetails.getConclusion();
+            if(conclusion != null) {
+                buildLogger.log("GitHub check (name: %s, status: %s, conclusion: %s) has been published.", gitHubDetails.getName(),
+                        gitHubDetails.getStatus(), conclusion);
+            }else {
+                buildLogger.log("GitHub check (name: %s, status: %s) has been published.", +gitHubDetails.getName(),
+                    gitHubDetails.getStatus());
+            }
+

Upstream changes

No response

Are you interested in contributing this feature?

Unfortunately no, because it is too complicated from the point of view of corporate procedures.

sfc-gh-kbregula avatar Jun 26 '24 10:06 sfc-gh-kbregula