notmuch email tagging 0.1

This commit is contained in:
Petr Nyc
2026-01-19 21:10:39 +01:00
parent 3c76055b05
commit a3a021ee18

306
bin/retag-email Executable file
View File

@@ -0,0 +1,306 @@
#!/usr/bin/env bash
set -x
set -e
#
# script to tag notmuch emails based on my preference
#
# inspired by https://forsooth.org/posts/email-in-spacemacs/index.html
#
#
# tags: important solaris oci osd
#
#
notmuch tag +sent -unread 'folder:/[Ss]ent.*/'
notmuch tag +me to:petr.nyc@oracle.com
# idea for logic
# sort by projects, don't unset new/read tag
# at the very bottom, unset the new/read tag based on if I'm interested in the latest
# status for the project / logs for the project and so on - good for stepping for someone
# General sorting rules not specific to projects
################################################################################
notmuch tag +important -- \
'subject:/[Cc]omplete.*[Tt]raining/' OR \
'subject:/.*Reminder:?/' OR \
'from:elanor.cz' OR \
'from:payroll_cz' OR \
'from:instructor.cz' OR \
subject:'Expense Report Approval' OR \
'subject:/[Aa]ction.[Nn]eeded/' OR \
from:permissions.oci.oraclecloud.com
notmuch tag +general \
subject:"Oracle Open Roles" OR \
from:tania.c.cortez OR \
from:info@eduagroup.cz OR \
subject:'FYI: Expense Reimbursement'
notmuch tag +calendar \
mimetype:text/calendar
# Solaris
################################################################################
# general solaris
notmuch tag +solaris +logs -- \
'subject:/.*BugDB.*release.deployment/' OR \
'subject:import/sig_ci/mercurial/mrspatmore' OR \
"(from:vcap_admin_ww_grp AND subject:/WARNING:|INFO:/)"
notmuch tag +solaris +logs \
'subject:Next IDR ID is'
notmuch tag +solaris \
from:deirdre.williams@oracle.com AND \
subject:'Sustaining Meeting'
# phabricator
notmuch tag +phabricator +logs -me \
from:noreply@scapen-phabricator.us.oracle.com
notmuch tag +s11.3-sru +on \
tag:phabricator AND \
'subject:/rONCLOSED|rONMAN|rONSRC/' and 'subject:/11.3/'
notmuch tag +s11.3-sru +userland \
tag: phabricator AND \
'subject:/\[Diffusion\].*rUSERLAND.*11\.3/'
notmuch tag +s11.4-sru +userland \
tag:phabricator AND \
'subject:/\[Diffusion\].*rUSERLAND.*11\.4/'
notmuch tag +mrspatmore \
tag:phabricator AND \
'subject:/\[Diffusion\].*rMRSPATMORE/'
notmuch tag +mrspatmore \
tag:phabricator AND \
'subject:/\[Diffusion\].*rREJENKINSLIB/'
notmuch tag +IPS \
tag:phabricator AND \
'subject:/\[Differential\]/' and body:'REPOSITORY NEAR/1 rPKG'
# akidr
notmuch tag +akidr +logs -unread from:vcap_admin_ww_grp AND subject:"Docker with ARU uploadcli has been automatically frozen"
notmuch tag +akidr \
to:'bot@artas' OR \
from:'bot@artas' OR \
to:'fishworks-gk_ww_grp@oracle.com' OR \
subject:'PASS s11_4aksruidr' OR \
subject:'Build started for AK IDR' OR \
subject:'New AK IDR request for'
notmuch tag +akidr +logs -unread \
from:'vcap_admin_ww_grp@oracle.com' AND \
subject:'ARU Uploads has been frozen for' AND \
subject:'this is a reminder please review'
notmuch tag +akidr +logs +important \
from:sig-devops_ww_grp AND \
'subject:/8\.\8.*idr.*DC.*has.failed/'
# WebRTI
notmuch tag +webrti body:Consolidation: AND body:RTI: AND subject:WebRTI:
notmuch tag +important tag:webrti AND to:petr.nyc and 'subject:/NEED.APPROVAL.*WebRTI/'
# BugDB
notmuch tag +bugdb \
from:ociapp-notifications and 'subject:/ER|Bug/'
# ON
notmuch tag +on tag:webrti AND body:"/Consolidation.*on"
notmuch tag +s11.3-sru tag:webrti AND tag:on AND body:"Gates:.*S11.SRU.Sustaining"
notmuch tag +s11.4-sru +logs +on \
'from:/root@sig-on-sru11-3-[xs]01/'
notmuch tag +s11u4-sru tag:webrti AND tag:on AND body:"Gates:.*11.4-SRU"
notmuch tag +on +pushlog subject:"/export.on-gate\/.*push/"
notmuch tag +on +trunk \
to:'gk@hubbins' OR to:'gatekeeper@hubbins' OR to:'hg@hubbins' OR \
from:'gatekeeper@hubbins'
notmuch tag +important \
tag:on and subject:'error' and '(from:gatekeeper@hubbins or to:gatekeeper@hubbins)'
notmuch tag +important +s11u4-sru +on\
from:sig-devops_ww_grp AND \
'subject:/INPUT.NEEDED.*11.4|s11u4_sust.*Ready.for/'
notmuch tag +trunk tag:on AND tag:pushlog body:"/Branch:.*default"
notmuch tag +s11.3-sru tag:on AND tag:pushlog body:"/Branch:.*s11u3-sru"
notmuch tag +on +trunk +logs '(to:gk-builds@hubbins.us.oracle.com OR to:gk-splice-builds@hubbins.us.oracle.com) AND body:"Build summary"'
notmuch tag +on +trunk +logs -unread \
from:noaccess AND \
'subject:/boston|eleven|hopper|on-gate-test|severin|smalls|stumpy|zero/'
notmuch tag +on +trunk +jenkins to:gk-jenkins@hubbins.us.oracle.com
notmuch tag +on +trunk +logs \
"(to:gk@hubbins.us.oracle.com' and subject:'zpool report for')" OR \
"(to:on-parfait@hubbins and subject:'Parfait Differences')"
notmuch tag +on +s11u4-sru +logs +important \
from:'gk@hubbins.us.oracle.com' AND \
subject:'New SRU branch from trunk'
notmuch tag +on +trunk +s11u4-sru +s11u3-sru +logs +important \
subject:on-repo-hooks
notmuch tag +on +s11u4-sru +important +logs \
'subject:/URGENT:.production.build-11.4.*/'
notmuch tag +on +pushlog \
to:hubbins AND 'subject:/.export\/on-gate.*push/'
notmuch tag +on +s11u4-sru +important +logs \
subject:"fail" AND subject:"Solaris_11/11.4/ON" AND subject:"11.4"
notmuch tag +on +s11u4-sru +important +logs \
subject:"fail" AND 'subject:/on-11u4-bld/'
notmuch tag +on +gkap +logs +s11u4-sru \
from:s11autoport_grp@oracle.com AND \
'(subject:"periodic GKAP push analysis") or subject:"GK Backport testing has completed "'
notmuch tag +on +gkap +logs +s11u4-sru \
from:rpe_sme_ww_grp@oracle.com AND subject:"/INTERIM.GK.Backport.report.for.GKAP_11.4.*/"
notmuch tag +on +logs +s11u4-sru \
'subject:/on-gate.s11u4..*.packages.ready/' OR \
'subject:/pass:.*Solaris_11/11.4/ON/production.build-11.4.*/' OR \
'subject:/^pass.*11.4..*.11.4.*..on-11u4-bld-[xs]./'
notmuch tag +on +important \
to:solaris_sru_gk_ww_grp AND \
subject:FAILED
# userland
notmuch tag +userland "subject:GATE OPEN" AND "from:solaris_sru_gk_ww_grp" AND body:userland
notmuch tag +userland tag:webrti AND "body:/Consolidation.*userland/"
notmuch tag +s11u4-sru tag:userland AND tag:webrti AND body:"/Gates:.*S11.4-SRU/"
notmuch tag +trunk tag:userland AND tag:webrti AND body:"/Gates:.*solaris-trunk/"
notmuch tag +userland to:userland-s11-sru-notify
notmuch tag +s11.3-sru \
tag:userland AND \
subject:'push to s11u3-sru'
notmuch tag +s11u4-sru \
tag:userland AND \
subject:'/.*push.to.s11u4_sust.*/'
# cluster
notmuch tag +cluster \
tag:webrti AND '(body:"/Consolidation:.*sc-geo/" or body:"Consolidation:.*suncluster")' OR \
subject:'SC4.4 SRU Nightly' OR from:'SC Build Engineering'
notmuch tag +important \
tag:cluster and 'subject:/[Ff]ail/'
# IPS
notmuch tag +IPS \
subject:'[Differential]' and body:'rPKG Solaris Image Packaging System'
# RE
notmuch tag +RE \
to:solaris-re_us_grp OR \
to:ips_tracker_support_ww_grp OR \
from:ips_tracker_support_ww_grp
notmuch tag +s11.3-sru \
tag:re AND \
'subject:/Oracle.Solaris.11\.3/'
notmuch tag +RE +s11u4-sru \
tag:RE AND \
'subject:/.*IDRs.*s11_4sru.*/'
notmuch tag +s11u4-sru \
tag:RE AND \
'subject:/RTI.*withdrawal.notification/' AND \
body:'11.4'
notmuch tag +s11u4-sru \
tag:RE AND \
'subject:/S11.4.*repo.ready.for.testing/'
notmuch tag +s11u3-sru \
tag:RE AND \
'subject:/.*IDRs.*s11_3sru.*/'
notmuch tag +cluster \
tag:re AND \
'(subject:/.*IDRs.*cluster.*/ OR subject:/SRU.Build.Package.Profile.successfully.created.for.solariscluster.*/)'
notmuch tag +akidr \
tag:RE AND \
'subject:/.*Tracker.FYI.*IDR.*state.change/'
notmuch tag +RE +s11.4-sru \
subject:'[Differential]' and body:'Repository rRETRUNK Release Engineering Trunk Gate'
notmuch tag +solaris \
tag:akidr OR \
tag:bugdb OR \
tag:cluster OR \
tag:IPS OR \
tag:on OR \
tag:phabricator OR \
tag:RE OR \
tag:trunk OR \
tag:userland OR \
tag:webrti
# end of Solaris
################################################################################
# OCI / OSD
################################################################################
notmuch tag +osd \
to:osd-devops_ww_grp@oracle.com OR \
subject:'[gbu confluence]'
notmuch tag +osd +brownbag \
'subject:/[Bb]rown.[Bb]ag/'
notmuch tag +deployment-ticket tag:osd AND subject:"New OSD deployment ticket:"
notmuch tag +ocean-incident tag:osd AND subject:"[Ocean Incident]"
notmuch tag +alarm tag:osd AND subject:'Alarm: '
notmuch tag +osd subject:'InfraCloud JIRA'
notmuch tag +osd +sgd \
subject:'SGD'
notmuch tag +oci +announcement \
subject:'A PSA'
# PRs for approval
notmuch tag +osd +PRs \
subject:'ACTION REQUIRED - Peer approval needed for Change Request' and \
body:'/Service Owner:.*Desktop as a Service/'
# PRs from other projects
notmuch tag +oci +CCAT-PRs \
subject:'ACTION REQUIRED - Peer approval needed for Change Request' and \
body:'/Service Owner:Compute Cloud at Customer/'
notmuch tag +oci tag:osd
################################################################################
# I don't want these in my focused inbox
################################################################################
# passed logs for on trunk
notmuch tag -inbox -unread tag:on AND tag:trunk AND tag:logs AND subject:"pass"
# trunk RTIs,pushlog,jenkins logs
notmuch tag -inbox -unread tag:trunk and tag:webrti
notmuch tag -inbox -unread tag:on AND tag:trunk AND tag:pushlog
notmuch tag -inbox -unread tag:on AND tag:trunk AND tag:jenkins
# ON GKAP notifications
notmuch tag -inbox -unread tag:gkap AND tag:logs
# osd ocean incidents, alarms
notmuch tag -inbox -unread tag:osd AND '(tag:ocean-incident or tag:alarm)'
# emails with subject:"REGION BUILD ALERT]" are important to watch