P210 23:31:30 13 FEB
GITHUB ACTION TO AUTOMATE SCREENSHOTS
06 MAY 2026

Screenshots can make project documentation much clearer, but they quickly become misleading when they fall out of date. I built update-screenshots-action to automate that maintenance: capture a web page, save the image in the repository, and update a known section of a Markdown file.

Implementation

The action takes a URL, opens it in Chromium through Playwright, and captures either a PNG or an animated GIF at a repository-relative path. It then rewrites a marked block in a Markdown file so the reference remains in sync with the generated asset. Optional commit-and-push support allows the action to run on a schedule or after changes to a site without requiring additional workflow steps. Even within that narrow scope, running reliably in CI required handling several operational details. Navigation is retried while local preview servers start, and commits are only created when one of the managed files has actually changed.

In use

This portfolio uses the action to refresh the homepage image shown in its root README. The action repository also runs the action against itself to maintain its demo screenshot, making the project both its own example and a practical check that the workflow continues to work.

View the project on GitHub