gh-triage
is a tool that helps you manage and triage GitHub issues and pull requests through unread notifications.
Key features of gh-triage
are:
- Done: Mark Issues and Pull Requests that match specified conditions as done
- Read: Mark Issues and Pull Requests that match specified conditions as read
- Unsubscribe: Unsubscribe from notifications for Issues and Pull Requests that match specified conditions
- Open: Open Issues and Pull Requests that match specified conditions in a browser
- List: Display Issues and Pull Requests that match specified conditions in a list
ref: Managing notifications from your inbox
$ gh triage
gh-triage
supports multiple configuration profiles. You can create different profiles for different workflows or environments.
# Use default profile
$ gh triage
# Use specific profile
$ gh triage --profile work
$ gh triage -p personal
- Default profile:
default.yml
- Named profiles:
{profile-name}.yml
For example:
~/.local/share/gh-triage/default.yml
(default profile)~/.local/share/gh-triage/work.yml
(work profile)~/.local/share/gh-triage/personal.yml
(personal profile)
$ gh extension install k1LoW/gh-triage
The configuration file is located at:
${XDG_DATA_HOME}/gh-triage/default.yml
(ifXDG_DATA_HOME
is set)- OR
~/.local/share/gh-triage/default.yml
(default location)
It will be automatically created on first run.
If you are upgrading from a previous version, your existing config.yml
will be automatically migrated to default.yml
on first run. The migration process:
- Checks if
default.yml
exists - If not, looks for the old
config.yml
file - If found, copies the content to
default.yml
- Removes the old
config.yml
file - Logs the migration process
This ensures a smooth transition without losing your existing configuration.
done:
max: 1000
conditions: # Auto-mark merged and closed PRs / issues as done
- "merged"
- "closed"
open:
max: 1
conditions: # Open PRs awaiting my review
- "is_pull_request && me in reviewers && passed && !approved && open && !draft"
list:
max: 1000
conditions: # List all unread notifications
- "*"
done
: Conditions and maximum number for marking as doneread
: Conditions and maximum number for marking as readunsubscribe
: Conditions and maximum number for unsubscribing from notificationsopen
: Conditions and maximum number for opening in browserlist
: Conditions and maximum number for listing
Each action has the following parameters:
max
: Maximum number of items to process at onceconditions
: Processing conditions (no processing if empty array)
gh-triage retrieves the following information for each notification, which can be used in condition evaluation:
Field | Type | Pull Request Description | Issue Description |
---|---|---|---|
is_pull_request |
bool |
Always true for Pull Requests |
Always false for Issues |
me |
string |
Username of authenticated user | Username of authenticated user |
title |
string |
The title of the Pull Request | The title of the Issue |
owner |
string |
Repository owner name | Repository owner name |
repo |
string |
Repository name | Repository name |
number |
int |
Pull Request number | Issue number |
state |
string |
State of the PR (open , closed ) |
State of the Issue (open , closed ) |
open |
bool |
Whether the PR is open | Whether the Issue is open |
closed |
bool |
Whether the PR is closed | Whether the Issue is closed |
labels |
[]string |
List of labels attached to the PR | List of labels attached to the Issue |
assignees |
[]string |
List of assigned users | List of assigned users |
author |
string |
Username of the PR author | Username of the Issue author |
html_url |
string |
GitHub URL of the PR | GitHub URL of the Issue |
draft |
bool |
Whether the PR is draft | N/A |
merged |
bool |
Whether the PR has been merged | N/A |
mergeable |
bool |
Whether the PR is mergeable | N/A |
mergeable_state |
string |
Mergeable state of the PR | N/A |
reviewers |
[]string |
List of requested reviewers | N/A |
review_teams |
[]string |
List of requested review teams | N/A |
approved |
bool |
Whether the PR has been approved | N/A |
review_states |
[]string |
History of review states | N/A |
status_passed |
bool |
Whether status checks have passed | N/A |
checks_passed |
bool |
Whether checks have passed | N/A |
passed |
bool |
Whether both status checks and checks have passed | N/A |
failed |
bool |
Whether status checks or checks have failed | N/A |
in_progress |
bool |
Whether status checks or checks are in progress | N/A |
unread |
bool |
Whether the PR is not marked as read | Whether the Issue is not marked as read |
Conditions are evaluated using the expr-lang library. You can write conditions such as:
conditions:
- "merged" # Merged Pull Request
- "closed" # Closed Issue/PR
- "approved" # Approved Pull Request
- "is_pull_request" # Pull Request
- "is_issue" # Issue
- "state == 'open'" # Open state
- "passed" # All checks passed
conditions:
- "merged && approved" # Merged and approved
- "is_pull_request && state == 'open'" # Open Pull Request
- "author == 'username'" # Created by specific user
- "len(labels) > 0" # Has labels
conditions:
- "'bug' in labels" # Has bug label
- "'hotfix' in labels" # Has hotfix label
- "len(assignees) > 0" # Has assignees
- "'APPROVED' in review_states" # Review states include approved
conditions:
- "*" # Match all (always true)
done:
max: 1000
conditions:
- "merged"
- "closed"
done:
max: 100
conditions:
- "is_pull_request && failed"
read:
max: 1000
conditions:
- "merged"
Option | Short | Description |
---|---|---|
--profile |
-p |
Specify profile name for configuration file |
# Use default profile
$ gh triage
# Use work profile
$ gh triage --profile work
# Use personal profile
$ gh triage -p personal
open:
max: 5
conditions:
- "author == me"
- "me in assignees"
list:
max: 100
conditions:
- "'urgent' in labels"
- "'bug' in labels"
read:
max: 1000
conditions:
- "is_pull_request && state == 'open' && !approved"
unsubscribe:
max: 100
conditions:
- "closed" # Closed Issues
- "merged" # Merged Pull Requests
To use this project from source, instead of a release:
go build .
gh extension remove triage
gh extension install .