Ported my @covidsewage bot over to Mastodon

Every morning it posts an image with the latest Covid sewage charts for various locations around the San Francisco Bay Area - because the sewage charts are the only figures I still trust!

The sewage doesn't lie

The screenshots come from https://covid19.sccgov.org/dashboard-wastewater - here's the latest image:

The bot runs entirely from this GitHub scheduled actions workflow: https://github.com/simonw/covidsewage-bot/blob/main/.github/workflows/toot.yml

It uses my https://shot-scraper.datasette.io/ CLI screenshot automation tool and the excellent https://toot.readthedocs.io/ Mastodon CLI utility

covidsewage-bot/toot.yml at main · simonw/covidsewage-bot

The @covidsewage bot. Contribute to simonw/covidsewage-bot development by creating an account on GitHub.

GitHub

@simon Have you thought about turning shot-scraper into it's own image with the browser pre-installed?

If you did this, it could be called as it's own GHA step and greatly reduce the number of steps needed to invoke it.

@webology I had not! I've not looked at that side of GitHub Actions at all, do you know if there are any good examples I could borrow from?

@simon the tl;dr is you add a Dockerfile (shot-scrapper install + playwright install) and an action.yml file to your repo and then you can call it / pass args/options to it like any other action step you use.

https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action is actually pretty good.

Creating a Docker container action - GitHub Docs

This guide shows you the minimal steps required to build a Docker container action.

GitHub Docs
@webology and then GitHub build the image once and reuse it for their workers? Neat, I should try that

@simon since it's been >6 months since I last played with it, I think I had to build the image and then push it on my own.

Then I had a Dockerfile which reference that image referenced in my actions.yml file. I need to try it out again because they may have updated it to just work without the build/push step.

@webology @simon When it's just a couple of simple steps, I stick with reusable workflows or composite actions.

I have a repo with a few simple things I've abstracted for my own usage that I use in a couple of repos: https://github.com/browniebroke/github-actions

For my usage, actions with Dockerfiles present too much overhead: building each run feels wasteful and I never got around to push the pre-built image.

GitHub - browniebroke/github-actions: A collection of my own GitHub actions

A collection of my own GitHub actions. Contribute to browniebroke/github-actions development by creating an account on GitHub.

GitHub
@browniebroke @simon the pre-built images are what speed things up. I'm not a fan of rebuilding on each run which, sadly is the default with GitHub Actions.