Skip to content

sebousan/hugo-maintenance-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hugo Maintenance Bot

Hugo Maintenance Bot

npm version

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)

Installation

npm install hugo-maintenance-bot
# or
yarn add hugo-maintenance-bot

Usage

# 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 website

Configuration

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
  - laptop

Environment Variables

  • GH_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)

GitHub Actions

You can automate the maintenance using GitHub Actions. An example workflow is provided in examples/github-action.yml.

This workflow:

  1. Runs on a schedule (e.g., every 2 months)
  2. Sets up Node.js and Hugo
  3. Installs dependencies and Playwright browsers
  4. Runs the maintenance script for your websites

About

An automated maintenance bot for Hugo websites

Topics

Resources

License

Stars

Watchers

Forks

Contributors