main
  1local lib = import './gmailctl.libsonnet';
  2
  3local toMe = {
  4  or: [
  5    { to: 'vdemeest@redhat.com' },
  6    { to: 'vdemeester@redhat.com' },
  7    { to: 'vincent@sbr.pm' },
  8  ],
  9};
 10local label_archive(filter, label) =
 11   [
 12    {
 13      filter: filter,
 14      actions: {
 15        archive: true,
 16        markSpam: false,
 17        labels: [ label ]
 18      }
 19    }
 20   ]
 21;
 22
 23local rh_mailing_list(name, label = '', archive = true) =
 24    local labels =
 25        if label == '' then
 26           [ std.join('/', std.splitLimit(name, '-', 1) ) ]
 27        else
 28           [ label ]
 29    ;
 30
 31    [
 32        {
 33          filter: {
 34            and: [
 35              { list: name + '.redhat.com' },
 36            ],
 37          },
 38          actions: {
 39            archive: false,
 40            markSpam: false,
 41            labels: labels
 42          }
 43        },
 44        {
 45          filter: {
 46            and: [
 47              { list: name + '.redhat.com' },
 48              { to: '-me' },
 49            ],
 50          },
 51          actions: {
 52            archive: archive,
 53            markSpam: false,
 54            labels: labels
 55          }
 56        }
 57    ]
 58;
 59
 60local google_groups(name, label = '', archive = true) =
 61    local labels =
 62        if label == '' then
 63           [ std.join('/', std.splitLimit(name, '-', 1) ) ]
 64        else
 65           [ label ]
 66    ;
 67
 68    [
 69        {
 70          filter: {
 71            and: [
 72              { list: name + '.googlegroups.com' },
 73            ],
 74          },
 75          actions: {
 76            archive: false,
 77            markSpam: false,
 78            labels: labels
 79          }
 80        },
 81        {
 82          filter: {
 83            and: [
 84              { list: name + '.googlegroups.com' },
 85              { to: '-me' },
 86            ],
 87          },
 88          actions: {
 89            archive: archive,
 90            markSpam: false,
 91            labels: labels
 92          }
 93        }
 94    ]
 95;
 96
 97{
 98  version: "v1alpha3",
 99  author: {
100    name: "Vincent Demeester",
101    email: "vdemeest@redhat.com"
102  },
103  // Note: labels management is optional. If you prefer to use the
104  // GMail interface to add and remove labels, you can safely remove
105  // this section of the config.
106  rules: rh_mailing_list('announce-list', 'announce', false) +
107    rh_mailing_list('aos-announce', 'announce', false) +
108    rh_mailing_list('aos-devel') +
109    rh_mailing_list('aos-int-services') +
110    rh_mailing_list('aos-logging') +
111    rh_mailing_list('cloud-strategy', 'area/cloud-strategy') +
112    rh_mailing_list('france-list', '02-france', false) +
113    rh_mailing_list('france-associates', '02-france', false) +
114    rh_mailing_list('cdg', '02-france', false) +
115    rh_mailing_list('emea-announce', 'announce', false) +
116    rh_mailing_list('eng-common-logging', 'aos/eng-common-logging') +
117    rh_mailing_list('insights-dev') +
118    rh_mailing_list('insights-platform') +
119    rh_mailing_list('managers-announce') +
120    rh_mailing_list('managers-list', 'managers/managers-list') +
121    rh_mailing_list('memo-list', 'memo-list') +
122    rh_mailing_list('monitoring', 'monitoring') +
123    rh_mailing_list('openshift-announce', 'aos/openshift-announce') +
124    rh_mailing_list('openshift-sme', 'aos/openshift-sme') +
125    rh_mailing_list('pnt-managers', 'managers/pnt-managers') +
126    rh_mailing_list('prod-dept', 'pnt/prod-dept') +
127    rh_mailing_list('remote-announce', '02-remote', false) +
128    rh_mailing_list('remotees-list', '02-remote', false) +
129    rh_mailing_list('rh-openstack-announce', 'pnt/rh-openstack-announce') +
130    rh_mailing_list('summitdemo2019', 'pnt/summitdemo2019') +
131    rh_mailing_list('tech-talk-announce', 'announce/tech-talk') +
132    rh_mailing_list('technical-users-list', 'technical-users') +
133    rh_mailing_list('upshift', 'psi') +
134    rh_mailing_list('usa-announce', 'announce/usa') +
135    rh_mailing_list('all-sales', 'sales') +
136    rh_mailing_list('devtools-build') +
137    rh_mailing_list('devtools-deploy') +
138    rh_mailing_list('devtools-lead') +
139    rh_mailing_list('devtools-saas') +
140    rh_mailing_list('devtools-pm') +
141    rh_mailing_list('devtools-architects') +
142    rh_mailing_list('devtools-team', 'devtools') +
143    rh_mailing_list('devx', 'devtools/devx') +
144    rh_mailing_list('serverless-interests', 'serverless') +
145    rh_mailing_list('serverless-dev', 'serverless/dev') +
146    google_groups('knative-dev', 'knative/dev') +
147    google_groups('knative-users', 'knative/users') +
148    google_groups('istio-dev', 'istio/dev') +
149    google_groups('istio-users', 'istio/users') +
150    rh_mailing_list('pipelines-interests', '00-pipelines/interests') +
151    rh_mailing_list('pipelines-dev', '00-pipelines/dev', false) +
152    rh_mailing_list('pipelines-extcomm', '00-pipelines/dev', false) +
153    rh_mailing_list('pipelines-bots', '00-pipelines/bots', true) +
154    rh_mailing_list('konflux', '01-konflux', false) +
155    rh_mailing_list('konflux-announce', '01-konflux', false) +
156    google_groups('konflux', '01-konflux', false) +
157    google_groups('tekton-dev', '00-tekton/dev', false) +
158    google_groups('tekton-users', '00-tekton/users', false) +
159    google_groups('tekton-governance', '00-tekton/governance', false) +
160    google_groups('tekton-vmt', '00-tekton/vmt', false) +  // Security: always keep in inbox
161    google_groups('tekton-code-of-conduct', '00-tekton', false) +
162    rh_mailing_list('engineering-advocate', 'engineering-advocate') +
163    rh_mailing_list('engineering-advocate-nomination', 'engineering-advocate') +
164    google_groups('kubernetes-sig-cli', 'kubernetes/sig/cli') +
165    google_groups('operator-framework', 'operator/dev') +
166    google_groups('google-summer-of-code-mentors-list', 'gsoc/mentors') +
167    // New mailing lists (2026-03)
168    rh_mailing_list('team-pipelines-product', '00-pipelines/product') +
169    rh_mailing_list('atlassian-migration-jira-group', 'announce') +
170    rh_mailing_list('global-engineering-all', 'announce') +
171    rh_mailing_list('cloudnativespeakers', 'area/conference') +
172    google_groups('wg-batch', 'kubernetes/batch', true) +
173    rh_mailing_list('cpaas-ops', '_tracker/cpaas') +
174    label_archive({from: 'do-not-reply@trello.com'}, '_tracker/trello') +
175    label_archive({from: 'help-ops@redhat.com'}, '_tracker/rh_service_now') +
176    # label_archive({from: 'hss-jira@redhat.com'}, '_tracker/jira') +
177    # label_archive({from: 'issues@jboss.org'}, '_tracker/jira') +
178    # label_archive({from: 'jira@jira.prod.coreos.systems'}, '_tracker/jira') +
179    label_archive({from: 'kundenservice@egencia.de'}, '_tracker/egencia') +
180    # label_archive({from: 'people-helpdesk@redhat.com'}, '_tracker/rh_service_now') +
181    # label_archive({from: 'redhat@service-now.com'}, '_tracker/rh_service_now') +
182    label_archive({from: 'workflow@redhat.com'}, '_tracker/ebs_workflow') +
183    label_archive({from: 'orangehrmlive.com'}, '_tracker/orange') +
184    label_archive({from: 'concursolutions.com'}, '_tracker/concur') +
185    label_archive({from: 'errata@redhat.com'}, '_tracker/errata') +
186    label_archive({from: 'builds@travis-ci.com'}, '_build/travis') +
187    #label_archive({from: 'cvp-ops@redhat.com'}, '_build/cvp') +
188    label_archive({from: 'buildsys@redhat.com'}, '_build/buildsys') +
189    label_archive({from: 'meet-recordings-noreply@google.com'}, '_recordings') +
190    // Meet notes & calendar noise (2026-03)
191    label_archive({from: 'gemini-notes@google.com'}, 'Notes') +
192    rh_mailing_list('bugzilla', '_tracker/bz') +
193  [
194    {
195      filter: {
196        query: "list:(*.github.com)"
197      },
198      actions: {
199        archive: true,
200        markRead: true,
201        labels: [
202          "area/github"
203        ]
204      }
205    },
206    {
207      filter: {
208        query: "list:(cvp-ops@redhat.com)"
209      },
210      actions: {
211        archive: true,
212        markRead: true,
213        markSpam: false,
214        labels: [
215          "_build/cvp"
216        ]
217      }
218    },
219    {
220      filter: {
221	from: "noreply+erratatool@redhat.com"
222      },
223      actions: {
224        archive: true,
225        markRead: true,
226        markSpam: false,
227        labels: [
228          "_tracker/errata"
229        ]
230      }
231    },
232    {
233      filter: {
234        from: "cpaas-ops@redhat.com"
235      },
236      actions: {
237        archive: true,
238        markRead: true,
239        markSpam: false,
240        labels: [
241          "_tracker/cpaas"
242        ]
243      }
244    },
245    {
246      filter: {
247        from: "noreply-cloud@google.com"
248      },
249      actions: {
250        labels: [
251          "cloud/google"
252        ]
253      }
254    },
255    {
256      filter: {
257        from: "customercare@ecompanystore.com"
258      },
259      actions: {
260        labels: [
261          "area/order"
262        ]
263      }
264    },
265    // Calendar cancelations — archive (2026-03)
266    {
267      filter: {
268        subject: "Canceled event"
269      },
270      actions: {
271        archive: true,
272        markRead: true,
273      }
274    },
275    // External newsletters — archive (2026-03)
276    {
277      filter: {
278        or: [
279          { from: "team@mail.cursor.com" },
280          { from: "info@newsletters.hellocse.fr" },
281          { from: "innovation@team.outsystems.com" },
282        ]
283      },
284      actions: {
285        archive: true,
286        markRead: true,
287      }
288    },
289  ],
290  labels: [
291    {
292      name: "area/admin",
293      color: {
294        background: "#98d7e4",
295        text: "#0d3b44"
296      }
297    },
298    {
299      name: "project/moby",
300      color: {
301        background: "#000000",
302        text: "#ffffff"
303      }
304    },
305    {
306      name: "area/ce"
307    },
308    {
309      name: "project/cdf"
310    },
311    {
312      name: "event/kubecon",
313      color: {
314        background: "#b99aff",
315        text: "#ffffff"
316      }
317    },
318    {
319      name: "status/waiting",
320      color: {
321        background: "#f2b2a8",
322        text: "#8a1c0a"
323      }
324    },
325    {
326      name: "area/interview",
327      color: {
328        background: "#000000",
329        text: "#ffffff"
330      }
331    },
332    {
333      name: "project/ocf",
334      color: {
335        background: "#b3efd3",
336        text: "#0b4f30"
337      }
338    },
339    {
340      name: "event/redhat-summit",
341      color: {
342        background: "#fb4c2f",
343        text: "#ffffff"
344      }
345    },
346    {
347      name: "area/training",
348      color: {
349        background: "#ffdeb5",
350        text: "#7a4706"
351      }
352    },
353    {
354      name: "project/docker",
355      color: {
356        background: "#b6cff5",
357        text: "#0d3472"
358      }
359    },
360    {
361      name: "area/learn",
362      color: {
363        background: "#e3d7ff",
364        text: "#3d188e"
365      }
366    },
367    {
368      name: "area/health"
369    },
370    {
371      name: "area/expense",
372      color: {
373        background: "#ffc8af",
374        text: "#7a2e0b"
375      }
376    },
377    {
378      name: "area/opensource",
379      color: {
380        background: "#b3efd3",
381        text: "#0b4f30"
382      }
383    },
384    {
385      name: "area/meetup"
386    },
387    // area/conference now managed by rulesLabels (cloudnativespeakers filter)
388    {
389      name: "area/travel",
390      color: {
391        background: "#fbe983",
392        text: "#594c05"
393      }
394    },
395  ] + lib.rulesLabels(self.rules),
396}