Skip to content

Instantly share code, notes, and snippets.

@kendallm
Created November 16, 2021 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendallm/f5a6bfea0321109377964346ed183e2b to your computer and use it in GitHub Desktop.
Save kendallm/f5a6bfea0321109377964346ed183e2b to your computer and use it in GitHub Desktop.
Example gmailctl configuration for github notifications
// 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