Supercharging GitHub Actions with Job Summaries and Pull Request comments
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?
- The process of adding Job Summaries is quite similar to the process of defining environment variables using the $GITHUB ENV variable.
- Simply output markdown content to the new environment variable $GITHUB STEP SUMMARY that we've created.
- When a job completes, all its step summaries are combined into a single job summary, which is displayed on the workflow run summary page.
- If numerous jobs generate summaries, the job summaries are arranged according to the order in which they were completed.
- 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.
An example of a job summary output from the actions run summary page is shown below.
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.
Below, is an output of Pull-Request comments in PR.
- 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.
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.