Skip to content

Instantly share code, notes, and snippets.

@ldez
Last active April 16, 2025 20:12
Show Gist options
  • Save ldez/bd6e6401ad0855e6c0de6da19a8c50b5 to your computer and use it in GitHub Desktop.
Save ldez/bd6e6401ad0855e6c0de6da19a8c50b5 to your computer and use it in GitHub Desktop.
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
from:([email protected]) subject:"PR \#" gh-pull-request

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

GitHub Actions

Filter Label
from:([email protected]) gha

Discussion

Filter Label
from:([email protected]) subject:"\(Discussion \#) gh-discussion

Releases

Filter Label
from:([email protected]) "Visit the release page to download them." gh-relases

Assignments

Filter Label
from:([email protected]) cc:([email protected]) gh-assignments

Mentions

Filter Label
from:([email protected]) cc:([email protected]) gh-mentions

Review Requested

Filter Label
from:([email protected]) cc:([email protected]) "requested your review on" gh-review-requested

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.
  • ci_activity: The notification arrived because CI activities (failure, success, ...)
  • push: The notification arrived because of a push

example:

Approximate rules

WARNING: Those rules can produce false-positives.

Closed (~)

label: gh-closed

Filter:

from:([email protected]) "Closed \#"

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

Merged (~)

label: gh-merged

Filter:

from:([email protected]) "Merged \#"

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

Issue (~)

label: gh-issue

Filter:

from:([email protected]) subject:("Issue \#" -"PR \#")

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

References

@tomjn
Copy link

tomjn commented Mar 10, 2025

I managed to improve the merge filter to reduce false positives by adding "Commit Summary" to the "does not have words" section, so it no longer flags the initial email with initial commits if you merged a main branch or feature branch in

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