Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gmail and GitHub - Filters

Gmail and GitHub

Create new filters and create new labels.

Pull Request

label: gh-pull-request

since 2021-10-11

from:(notifications@github.com) subject:"PR \#" 

Note: special characters like ( or # are ignored and the escape \ doesn't work.

before 2021-10-11

from:(notifications@github.com) AND {"Patch Links" "approved this pull request." "requested changes on this pull request." "commented on this pull request." "pushed AROUND 1 commit" "pushed AROUND 2 commits"}

Assignments

label: gh-assignments

from:(notifications@github.com) cc:(assign@noreply.github.com)

Mentions

label: gh-mentions

from:(notifications@github.com) cc:(mention@noreply.github.com)

Review Requested

label: gh-review-requested

from:(notifications@github.com) {cc:(review_requested@noreply.github.com) "requested your review on"}

GitHub emails

  • subscribed: The notification arrived because you’re watching the repository.
  • manual: The notification arrived because you’ve specifically decided to subscribe to the thread (via an Issue or Pull Request).
  • author: The notification arrived because you’ve created the thread.
  • comment: The notification arrived because you’ve commented on the thread.
  • mention: The notification arrived because you were specifically @mentioned in the content.
  • team_mention: The notification arrived because you were on a team that was mentioned (like @org/team).
  • state_change: The notification arrived because you changed the thread state (like closing an Issue or merging a Pull Request).
  • assign: The notification arrived because you were assigned to the Issue.
  • review_requested: The notification arrived because your review is required.

example:

Approximate rules

WARNING: Those rules can produce false-positives.

Closed (~)

label: gh-closed

from:(notifications@github.com) "Closed \#"

Note: special characters like ( or # are ignored and the escape \ doesn't work.

Merged (~)

label: gh-merged

from:(notifications@github.com) "Merged \#"

Note: special characters like ( or # are ignored and the escape \ doesn't work.

Issue (~)

label: gh-issue

since 2021-10-11

from:(notifications@github.com) subject:("Issue \#" -"PR \#")

Note: special characters like ( or # are ignored and the escape \ doesn't work.

References

@lizozom

This comment has been minimized.

Copy link

@lizozom lizozom commented Apr 14, 2019

Great work. Implemented in my own gmail setup :)

@insipx

This comment has been minimized.

Copy link

@insipx insipx commented Apr 19, 2019

Awesome! This should make github notifications much easier to deal with in my email.

Also, keep in mind you can keep multiple Emails in Github and assign different emails to receive notifications based on a Github Organization. Useful if you like to alias multiple emails to handle different categories of mail

@insipx

This comment has been minimized.

Copy link

@insipx insipx commented Jul 31, 2019

Anyone know if there is a good way to filter for releases only?

@fatmcgav

This comment has been minimized.

Copy link

@fatmcgav fatmcgav commented Sep 20, 2019

Note that it's possible to get "false positives" on the Merged search above...

Using from:(notifications@github.com) "merged AROUND 1 into" gives better results :)

@EasyAsABC123

This comment has been minimized.

Copy link

@EasyAsABC123 EasyAsABC123 commented Sep 26, 2019

Perhaps utilizing regex instead of hardcoding numbers? Example: from:(notifications@github.com) AND {"Patch Links" "approved this pull request." "requested changes on this pull request." "commented on this pull request." "pushed /d+ commit."}

@tmandry

This comment has been minimized.

Copy link

@tmandry tmandry commented Dec 17, 2020

You can't use regex in gmail filters, but you can use the AROUND operator. This works for me:

{"pushed AROUND 1 commit" "pushed AROUND 1 commits"}

@johnkord

This comment has been minimized.

Copy link

@johnkord johnkord commented Oct 8, 2021

To filter out GitHub Code Owners review requests (as part of a group/team) but still find review requests in which my GitHub username is explicitly added, I used this search expression:
from:(notifications@github.com) cc:(review_requested@noreply.github.com) "requested your review on"

It is almost identical to the search expression found in the original post, but it removes the OR braces around the last two search parameters. Hope that someone finds this useful!

@oscard0m

This comment has been minimized.

Copy link

@oscard0m oscard0m commented Nov 7, 2021

With latest changes in GitHub email notifications, filters for issue and pr can be improved: https://github.blog/changelog/2021-10-11-improved-notification-email-titles-for-issues-and-prs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment