Skip to content

Instantly share code, notes, and snippets.

@ldez
Last active November 7, 2024 14:56
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

@maciejsobon
Copy link

Very handy! Cheers :)

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