Automatically Archiving Dependabot and Semantic Release Emails

Created on .

Read in 1 minute.

As an Open Source maintainer, I get hundreds of emails a day from Dependabot and Semantic Release. A while back, I put together the below Google Apps Script snippet to automatically archive the emails based upon some simple regex patterns to accomplish the following tasks:

  • Archive Dependabot emails that are merged or closed.
  • Archive Semantic Release publish notifications on issues and pull requests.

Currently this is running in a cron every 5 minutes.

function main() {
// archive dependabot notifications
GmailApp.moveThreadsToArchive('label:"inbox" from:dependabot[bot]').filter((thread) =>
threadMatches(thread, [/Merged .* into .*/, /Closed /])

// archive semantic release publish notifications
GmailApp.moveThreadsToArchive('label:"inbox" from:github-actions[bot]').filter((thread) =>
threadMatches(thread, [
/This PR is included in version/,
/This issue has been resolved in version/,

function threadMatches(thread, patterns) {
const messages = thread.getMessages();

if (messages.length > 1) {
for (let message of messages) {
for (let pattern of patterns) {
const match = message.getBody().match(pattern);

if (match) {
return true;

return false;

This is all pretty basic, but it does the job. Future work might focus on inverting the dependabot functionality so that depending on the date of the thread and current status of the pull request, the thread will be moved to the inbox if action is required.

I have yet to find the perfect workflow for my open source work spanning different repositories, organizations, etc. Email is a good backstop for complete coverage and the scripts above give me some eventual consistency.


Strava Webhooks with


Rebasing All Dependabot Pull Requests


Get the RSS feeds: All, Run, Code.