An automated maintenance bot for Hugo websites.
It handles:
- Updating Hugo modules
- Taking screenshots (before/after)
- Comparing screenshots
- Creating Pull Requests with visual diffs
- Merge automatically if there is no diffs
- Creating content markdown page (for your maintenance report website)
npm install hugo-maintenance-bot
# or
yarn add hugo-maintenance-bot# Process all sites in the datas directory
npx hugo-maintenance
# Process all sites in a specific folder : datas/folder
npx hugo-maintenance folder
# Process a specific site : datas/folder/website.yaml
npx hugo-maintenance websiteThe bot expects a datas/ directory in the current working directory containing site configurations in YAML format.
Example site config (datas/folder/website.yaml):
title: My Site
name: mysite
repository:
branch: main
provider: github
repo: username/repo
website:
url: https://www.mysite.com
pages:
- /
- /contact/
screenshots:
- mobile
- tablet
- laptopGH_TOKEN: GitHub Personal Access Token (required for PR creation and cross-repo operations)GIT_USER_EMAIL: Git user email (required for PR creation)GIT_USER_NAME: Git user name (required for PR creation)
You can automate the maintenance using GitHub Actions. An example workflow is provided in examples/github-action.yml.
This workflow:
- Runs on a schedule (e.g., every 2 months)
- Sets up Node.js and Hugo
- Installs dependencies and Playwright browsers
- Runs the maintenance script for your websites