Example gmailctl configuration for github notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Please refer to https://github.com/mbrt/gmailctl#configuration for docs about | |
// the config format. | |
local lib = import 'gmailctl.libsonnet'; | |
// Some useful variables on top | |
// TODO: Put your email here | |
local me = 'email@example.com'; | |
local toMe = { to: me }; | |
// Non-@mention GitHub notifications | |
local githubNotifications = [ | |
{ type: 'assign', label: 'assign' }, | |
{ type: 'author', label: 'author' }, | |
{ type: 'comment', label: 'comment' }, | |
{ type: 'manual', label: 'manual' }, | |
{ type: 'push', label: 'push' }, | |
{ type: 'review_requested', label: 'review requested' }, | |
{ type: 'security_alert', label: 'security alert' }, | |
{ type: 'state_change', label: 'state change' }, | |
{ type: 'subscribed', label: 'subscribed' }, | |
{ type: 'team_mention', label: 'team mention' }, | |
{ type: 'your_activity', label: 'your activity' }, | |
]; | |
local githubMentionRules = [ | |
{ | |
filter: { | |
and: [ | |
{ from: 'notifications@github.com' }, | |
{ cc: 'mention@noreply.github.com' }, | |
], | |
}, | |
actions: { | |
labels: ['github/mention'], | |
markimportant: true, | |
markspam: false, | |
}, | |
} | |
]; | |
local githubRules = [ | |
{ | |
filter: { | |
and: [ | |
{ from: 'notifications@github.com' }, | |
{ cc: notification.type + '@noreply.github.com' }, | |
], | |
}, | |
actions: { | |
archive: true, | |
labels: [ | |
'github/' + notification.label, | |
], | |
}, | |
} | |
for notification in githubNotifications | |
] + githubMentionRules; | |
local honeybadgerRules = [ | |
{ | |
filter: { from: 'notifications@honeybadger.io' }, | |
actions: { | |
labels: ['honey badger'], | |
archive: true | |
} | |
} | |
]; | |
local rules = [ | |
{ | |
filter: toMe, | |
actions: { | |
markImportant: true, | |
}, | |
}, | |
{ | |
filter: { from: 'mongodb-atlas-alerts@mongodb.com' }, | |
actions: { | |
labels: ['mongodb atlas'], | |
archive: true | |
} | |
}, | |
{ | |
filter: { from: 'meet-recordings-noreply@google.com'}, | |
actions: { | |
labels: ['meetings'], | |
archive: true | |
} | |
} | |
] + githubRules + honeybadgerRules; | |
// The actual configuration | |
{ | |
// Mandatory header | |
version: 'v1alpha3', | |
author: { | |
name: 'Firstname Lastname', | |
email: me, | |
}, | |
rules: rules, | |
labels: lib.rulesLabels(rules), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment