A Google Apps Script that sends notifications whenever someone edits a GitHub wiki. Can send notifications via email or Discord webhook. Requires the cheeriogs script library.
- Create a new Google Apps Script project
- Follow the instructions on the cheeriogs page to add Cheerio to your project
- Copy the code from my Code.gs file into your project and hit Ctrl-S to save
- Click the Project Settings tab on the left, scroll down and click "Add script property"
- Create a property called
GITHUB_REPO
. Its value should be the full name of the repository you want to monitor, such asn0samu/gh-wiki-monitor
. - If you want to receive email notifications, create a script property called
EMAIL_ADDRESS
and set it to your email address. - If you want to receive notifications in a Discord channel, first follow the instructions in the "Making a Webhook" section of this article. (Ignore the "GitHub Webhook Integration" section - that only allows you to receive notifications for issues, PRs, etc - not wiki edits.) Copy the webhook URL, then create a script property called
DISCORD_WEBHOOK
and paste in the webhook URL. - Save your script properties, then click the Triggers tab on the left.
- Click "Add a Trigger", then under "Choose which function to run" select "main".
- Use the "Time-driven" event source and choose how often you want the script to check for edits. I suggest setting the script to run every 10 minutes.
That's it! Now you can get notified whenever someone edits your wiki, instead of discovering some rando deleted your documentation a week after the fact! 😅