gh-triage is a tool that helps you manage and triage GitHub issues, pull requests, and discussions through unread notifications.
Key features of gh-triage are:
- Done: Mark Issues, Pull Requests, and Discussions that match specified conditions as done
- Read: Mark Issues, Pull Requests, and Discussions that match specified conditions as read
- Unsubscribe: Unsubscribe from notifications for Issues, Pull Requests, and Discussions that match specified conditions
- Open: Open Issues, Pull Requests, and Discussions that match specified conditions in a browser
- List: Display Issues, Pull Requests, and Discussions that match specified conditions in a list
ref: Managing notifications from your inbox
$ gh triagegh-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-triageThe configuration file is located at:
${XDG_DATA_HOME}/gh-triage/default.yml(ifXDG_DATA_HOMEis 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.ymlexists - If not, looks for the old
config.ymlfile - If found, copies the content to
default.yml - Removes the old
config.ymlfile - 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 | Discussion Description |
|---|---|---|---|---|
is_pull_request |
bool |
Always true for Pull Requests |
Always false for Issues |
Always false for Discussions |
is_issue |
bool |
Always false for Pull Requests |
Always true for Issues |
Always false for Discussions |
is_discussion |
bool |
Always false for Pull Requests |
Always false for Issues |
Always true for Discussions |
me |
string |
Username of authenticated user | Username of authenticated user | Username of authenticated user |
title |
string |
The title of the Pull Request | The title of the Issue | The title of the Discussion |
owner |
string |
Repository owner name | Repository owner name | Repository owner name |
repo |
string |
Repository name | Repository name | Repository name |
number |
int |
Pull Request number | Issue number | Discussion number |
state |
string |
State of the PR (open, closed) |
State of the Issue (open, closed) |
State of the Discussion (open, closed) |
open |
bool |
Whether the PR is open | Whether the Issue is open | Whether the Discussion is open |
closed |
bool |
Whether the PR is closed | Whether the Issue is closed | Whether the Discussion is closed |
labels |
[]string |
List of labels attached to the PR | List of labels attached to the Issue | List of labels attached to the Discussion |
assignees |
[]string |
List of assigned users | List of assigned users | N/A |
author |
string |
Username of the PR author | Username of the Issue author | Username of the Discussion author |
html_url |
string |
GitHub URL of the PR | GitHub URL of the Issue | GitHub URL of the Discussion |
draft |
bool |
Whether the PR is draft | N/A | N/A |
merged |
bool |
Whether the PR has been merged | N/A | N/A |
mergeable |
bool |
Whether the PR is mergeable | N/A | N/A |
mergeable_state |
string |
Mergeable state of the PR | N/A | N/A |
reviewers |
[]string |
List of requested reviewers | N/A | N/A |
review_teams |
[]string |
List of requested review teams | N/A | N/A |
approved |
bool |
Whether the PR has been approved | N/A | N/A |
review_states |
[]string |
History of review states | N/A | N/A |
status_passed |
bool |
Whether status checks have passed | N/A | N/A |
checks_passed |
bool |
Whether checks have passed | N/A | N/A |
passed |
bool |
Whether both status checks and checks have passed | N/A | N/A |
failed |
bool |
Whether status checks or checks have failed | N/A | N/A |
in_progress |
bool |
Whether status checks or checks are in progress | N/A | N/A |
answered |
bool |
N/A | N/A | Whether the Discussion has been answered |
unread |
bool |
Whether the PR is not marked as read | Whether the Issue is not marked as read | Whether the Discussion 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/Discussion
- "approved" # Approved Pull Request
- "is_pull_request" # Pull Request
- "is_issue" # Issue
- "is_discussion" # Discussion
- "answered" # Answered Discussion
- "state == 'open'" # Open state
- "passed" # All checks passedconditions:
- "merged && approved" # Merged and approved
- "is_pull_request && state == 'open'" # Open Pull Request
- "author == 'username'" # Created by specific user
- "len(labels) > 0" # Has labelsconditions:
- "'bug' in labels" # Has bug label
- "'hotfix' in labels" # Has hotfix label
- "len(assignees) > 0" # Has assignees
- "'APPROVED' in review_states" # Review states include approvedconditions:
- "*" # 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 personalopen:
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/Discussions
- "merged" # Merged Pull Requestsdone:
max: 100
conditions:
- "is_discussion && answered"list:
max: 100
conditions:
- "is_discussion && !answered && open"To use this project from source, instead of a release:
go build .
gh extension remove triage
gh extension install .