From adad5fbdcaf4115b751c6caee3af401b33e2efdc Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 2 Feb 2014 02:37:50 +0100 Subject: Filter GitHub notification emails Have GitHub send notifications to plugins+github@, and try to distinguish actual user comments from mere status change reports. Right now, both types of notifications are forwarded to the devel@ list, but in the future, we could choose to omit the status change emails. While at it, the messages are also modified to make them more suitable for being forwarded to a mailing list. --- etc/forward | 1 - etc/procmailrc | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) delete mode 100644 etc/forward create mode 100644 etc/procmailrc (limited to 'etc') diff --git a/etc/forward b/etc/forward deleted file mode 100644 index ece2155..0000000 --- a/etc/forward +++ /dev/null @@ -1 +0,0 @@ -admin@monitoring-plugins.org diff --git a/etc/procmailrc b/etc/procmailrc new file mode 100644 index 0000000..ea35845 --- /dev/null +++ b/etc/procmailrc @@ -0,0 +1,42 @@ +SHELL = /bin/sh +PATH = /usr/bin:/bin +LOGFILE = $HOME/log/procmail.log +GITHUB_FILTER = $HOME/libexec/filter-github-emails +DEFAULT_RECIPIENT = admin@monitoring-plugins.org +EXTENSION = $1 + +# +# Handle emails sent to . +# +:0 +* EXTENSION ?? ^^github^^ +* ! ^X-Loop: plugins@monitoring-plugins\.org +{ + :0 fw + | $GITHUB_FILTER + + :0 fhw + * ^To:(.*[^-a-zA-Z0-9_.])?devel@monitoring-plugins\.org + | formail -A 'X-Loop: plugins@monitoring-plugins.org' + + :0 a + ! devel@monitoring-plugins.org +} + +# +# Handle emails that shouldn't be forwarded to the mailing list. +# +:0 +* ! ^X-Loop: plugins@monitoring-plugins\.org +{ + FROM = `formail -c -x 'From ' | cut -d ' ' -f 1` + + :0 fhw + | formail -A 'X-Loop: plugins@monitoring-plugins.org' \ + -A "X-Original-From: $FROM" + + :0 + ! $DEFAULT_RECIPIENT +} + +# vim:set filetype=procmail: -- cgit v1.2.3-74-g34f1