Table of Contents
I’ve recently completely revamped the publishing pipeline for my blog, moving to a fully automated, hands-free GitHub Actions workflow. Since my blog uses Hugo and is hosted on GitHub Pages, I wanted a robust GitFlow setup: isolating new posts in feature branches, running automated tests against a long-standing develop branch, and then gracefully releasing to main.
Here is a breakdown of the automated architecture I’ve set up.
The GitFlow Strategy
Instead of pushing directly to the main branch and hoping nothing breaks, I use a three-tier branching strategy:
- Feature Branches: Every new blog post gets its own isolated branch (e.g.,
blog-post/my-new-article). - The
developBranch: This is my long-standing staging environment. Feature branches submit Pull Requests (PRs) todevelop. - The
mainBranch: The production environment. Once changes indevelopare verified, a release PR merges them intomain.
Automated Testing with Playwright
To ensure the site builds correctly and there are no broken links or rendering issues, I use Playwright. I have a GitHub Action (playwright.yml) that triggers every time a PR is opened against develop or main.
The action spins up an Ubuntu container, installs Hugo, builds the site, runs my Playwright E2E test suite, and caches the dependencies to speed up future runs.
If the tests pass successfully, the Action automatically applies a custom merge-when-passing label to the PR via the GitHub API.
The Auto-Merge Gate
This is where the magic happens. I have an auto-merge.yml Action that listens for that specific merge-when-passing label.
Once the label is applied, the Action uses the GitHub CLI (gh pr merge) to automatically merge the PR.
A Critical Safeguard: To keep the repository clean, the Action deletes the source branch after merging. However, since my develop branch is a permanent staging branch, I added a conditional check: if the PR is merging from a feature branch, it deletes the branch. But if the PR is merging develop into main, it merges safely without deleting develop.
Deployment to GitHub Pages
Finally, when the release PR merges into main, my deploy.yml Action is triggered. It does a final production build using hugo --minify and deploys the generated static files directly to my GitHub Pages repository (StaticVish/staticvish.github.io).
Tying it Together with OpenClaw
To make this truly hands-free, my AI assistant, Jennifer (running via OpenClaw), handles the entire Git side of things. When I finish drafting a post with her, she automatically:
- Checks out
developand cuts a new feature branch. - Formats and saves the Markdown file.
- Commits and pushes the branch.
- Uses the local
ghCLI to open a PR todevelop, and subsequently opens a release PR tomain.
From idea to published post, my hands never touch the keyboard for git commands. The robots are doing the heavy lifting, and I just get to enjoy the writing!