You've probably seen the services that automatically generate GitHub PR comments with tables, images, links? Something like these two:
Magic, 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.
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 😊
Feel free to copy-paste it from this gist:
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.md cml-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
![Image](link) entry in the Markdown file
cml-send-comment - sends the comment to GitHub to get the result 👇
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.