A lightweight, zero-dependency automation tool built on Google Apps Script to synchronize, create, and manage your GitHub notification labels in Gmail.
- Smart Hierarchy: Automatically creates a nested label structure:
GitHub/Organization/Repository. - PR Status Tracking: Labels emails as
MergedorClosed. - Personal Activity Detection: Distinct labels for actions performed by you:
Closed by meMerged by meApproved by meRequested changes by me
- Dynamic Repository Discovery: Automatically detects and creates labels for new repositories as you receive notifications.
- Persistent Styling: Once a label is created, you can change its color in Gmail, and the script will preserve your choice as long as the label exists.
- Go to script.google.com and create a New Project.
- Paste the code from
Code.gs. - Click Run to authorize the script.
To make it run automatically:
- Click the Triggers (clock icon) on the left sidebar.
- Click + Add Trigger.
- Choose the
markGitHubPullRequestsfunction. - Set the event source to Time-driven.
- Set the interval (e.g., every 5 or 10 minutes).
This is how your inbox will look with automatic repository and status labels:
The script scans emails from the last hour and analyzes hidden technical headers:
X-GitHub-PullRequestStatus: To determine if a PR is closed or merged.X-GitHub-Reason: To detect if the notification was triggered by your activity.List-Archive: To extract the organization and repository name.
Found a bug or have a feature request? Please open an issue: https://github.com/varvashenya/gas-github-labels/issues
Licensed under the Apache License, Version 2.0.

