Canarys | IT Services

Blogs

Supercharging GitHub Actions with Job Summaries and Pull Request comments

,
Share

Job Summaries

A new feature on GitHub allows you to write job descriptions for your actions. It enables you to produce markdown as part of your workflow, render it as an output of the run in the GitHub UI, and publish it as a job summary. Custom Markdown content can be used for a wide range of inventive tasks, including gathering and displaying test results, producing reports, and creating custom output that is independent of logs.

How to create Job Summaries?

  1. The process of adding Job Summaries is quite similar to the process of defining environment variables using the $GITHUB ENV variable.
  2. Simply output markdown content to the new environment variable $GITHUB STEP SUMMARY that we’ve created.
  3. When a job completes, all its step summaries are combined into a single job summary, which is displayed on the workflow run summary page.
  4. If numerous jobs generate summaries, the job summaries are arranged according to the order in which they were completed.
  5. The Actions run summary page will display any Markdown content that is added as shown in the sample below.

       Below is the example workflow details.

jobsummary-1

 An example of a job summary output from the actions run summary page is shown below.

jobsummary-2

Pull-Request comment:

The Pull Request comment is a quick overview of how a pull request will affect the code coverage. This simple integration allows developers to see the effects of their work, without having to leave the familiar GitHub UI. It provides details on the coverage changes in the pull request that help with speeding up code reviews and ensuring that all incoming features and fixes are well tested. Now, using the same familiar functionality that powers pull requests and issues, an action can generate custom Markdown content on the run summary generated by each job. The comment is customizable to adjust the behavior and logic, as well as the actual output.

        See below for example workflow details.

      jobsummary-3

        Below, is an output of Pull-Request comments in PR.

    jobsummary-4

Benefits:

  • Independent of logs, the generation of reports and custom output.
  • The Pull-request makes it simple to view the results.
  • A typical scenario for CI is running tests.
  • Job summaries are written in markdown, making it simple to understand them as you see the output be generated.
  • You can customize to your needs and experience the power of GitHub Actions’ markdown output.

Conclusion:

This functionality, which is accessible in GitHub Actions along with Job Summaries and Pull Request comments, allows us to group specific Markdown elements on the Actions run summary page. Your work will be more effectively visualized, and we might even make it more personalized.

Leave a Reply

Your email address will not be published. Required fields are marked *

Reach Us

With Canarys,
Let’s Plan. Grow. Strive. Succeed.