gh minimize

GitHub CLI extension to minimize (hide) issue and pull request comments with a reason such as "off-topic", "resolved", or "spam".
Install
Make sure you have version 2.0 or
newer of the GitHub CLI installed.
gh extension install heaths/gh-minimize
Usage
List issue or review comments so you can find comment IDs:
gh minimize list 123
gh minimize list 123 --author octocat --author hubot --body-grep 'obsolete.*context'
gh minimize list 123 --json id,author,isMinimized
gh minimize list 123 --jq '.[].author'
gh minimize list 123 --jq '[.[] | select(.authorType == "bot")]'
gh minimize list 123 --template '{{range .}}{{printf "%s\t%t\n" .author .isMinimized}}{{end}}'
Use -R / --repo to target another repository in [HOST/]OWNER/REPO format.
Minimize or unminimize a comment directly by ID:
gh minimize --id MDEyOklzc3VlQ29tbWVudDE= --reason off-topic
gh minimize --id MDEyOklzc3VlQ29tbWVudDE= --undo
Filter comments in an issue or pull request by author and/or body regex:
gh minimize 123 --author octocat --body-grep 'obsolete.*context' --reason outdated
gh minimize 123 --author octocat --body-grep 'obsolete.*context' --undo
Valid --reason values:
abuse
duplicate
low-quality
off-topic
outdated
resolved
spam
GitHub Actions
You can use this extension in an issue_comment (used for both issues and pull requests) workflow with only the permissions needed to minimize comments:
on:
issue_comment:
types:
- created
- edited
permissions:
pull-requests: write
jobs:
minimize:
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- run: |
gh ext install heaths/gh-minimize
gh minimize ${{ github.event.pull_request.number }} --author github-actions --body-grep 'new changes have been pushed to this pull request' --reason outdated
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
License
Licensed under the MIT license.