An Interest In:
Web News this Week
- March 26, 2025
- March 25, 2025
- March 24, 2025
- March 23, 2025
- March 22, 2025
- March 21, 2025
- March 20, 2025
Learning GitHub Actions: Creating Beautiful PR Comments
You've probably seen the services that automatically generate GitHub PR comments with tables, images, links? Something like these two:
Codecov and Calibre reportsMagic, right ? Let's see how it can be done. We won't even need to use command line or offline editors this time!. This post covers:
- How to create a "Hello world!" GitHub action online
- Use CML scripts to generate comments with a custom Markdown that includes a picture .
Read more about CML. Besides GitHub comments, it can do the same for GitLab. Also, it's important that it was built with Machine Learning workflow in mind and automates a lot of tedious tasks in ML. besides simple reports.
Step 1: Create Action File
You can do this using GitHub online UI! Add the file .github/workflows/cml.yaml
to your repo like this:
Btw, I've forked the DVC example get started repo to play with actions in this tutorial - feel free to do the same
Step 2: Add "Hello world!" Action
Feel free to copy-paste it from this gist:
Step 3: Add Images
That's where the the magic happens! Let's update a few lines of code like this (copy-paste from this gist):
cml-publish prc.svg --md >> report.mdcml-send-comment report.md
That's pretty all you need if you use the CML docker to run the action!
We specifically don't focus on the other three lines of the action, those that generate the image. It's out of scope of this post and it's specific to the repository. We definitely recommend reading it and DVC docs if you are machine learning practitioner.
cml-publish
- saves an image and creates an 
entry in the Markdown file report.md
cml-send-comment
- sends the comment to GitHub to get the result
Step 4: Profit
The result looks like this:
In this case it includes a precision-recall curve which is a fundamental and useful characteristic for a binary classifier. But you can include any images, any text using Markdown markup to create your own unique and useful report!
That's it for today
We've just barely scratched the surface of the GitHub actions and CML capabilities! We definitely recommend taking a look at the actions marketplace.
And of course, read more about CML. Besides GitHub comments, it can do the same for GitLab. It was built with Machine Learning workflow in mind and automates a lot of tedious tasks in ML - like running training remotely.
Original Link: https://dev.to/shcheklein/learning-github-actions-creating-beautiful-pr-comments-ibk

Dev To

More About this Source Visit Dev To