@sebousan/hugo-maintenance-bot
v1.2.1
Published
Automated maintenance bot for Hugo websites (module updates, screenshots, PRs)
Maintainers
Readme
Hugo Maintenance Bot
An automated maintenance bot for Hugo websites.
It handles:
- Updating Hugo modules
- Taking screenshots (before/after)
- Comparing screenshots
- Creating Pull Requests with visual diffs
- Merging automatically if there are no visual differences
- Creating content markdown page (for your maintenance report website)
- Sending notifications (Discord, Slack, email...)
Installation
npm install @sebousan/hugo-maintenance-bot
# or
yarn add @sebousan/hugo-maintenance-botUsage
# 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 websiteConfiguration
The 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
- laptopEnvironment Variables
| Variable | Required | Description |
| --- | --- | --- |
| GH_TOKEN | ✅ | GitHub Personal Access Token (PR creation, branch management) |
| GIT_USER_EMAIL | ✅ | Git user email for commits |
| GIT_USER_NAME | ✅ | Git user name for commits |
Notifications
Notifications are sent at the end of each site processing. A channel is automatically activated when its environment variable is set — no configuration needed.
| Channel | Environment variable | Status |
| --- | --- | --- |
| Discord | DISCORD_WEBHOOK_URL | ✅ Available |
| Slack | SLACK_WEBHOOK_URL | ✅ Available |
| Email | SMTP_HOST | Coming soon |
To get a Discord webhook URL: go to your Discord server settings → Integrations → Webhooks → New Webhook.
GitHub Actions
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
