Advanced Techniques for Filtering GitHub Issues and Pull Requests
GitHub's search syntax supports Boolean combinations of over 20 query qualifiers—including author, assignee, status API results, and date ranges—to filter issues and pull requests with surgical precision.
The tiimgreen/github-cheat-sheet repository documents these hidden search capabilities that extend far beyond basic label filtering. Mastering these advanced techniques for filtering GitHub issues and pull requests enables precise repository triage, automated stale-issue detection, and CI-driven code review workflows.
Core Search Qualifiers
GitHub's query language exposes granular filters across user identity, temporal boundaries, and CI/CD state according to the source documentation.
Identity and Assignment
- author:USERNAME – Items opened by the specified user (e.g.,
author:tiimgreen). - assignee:USERNAME – Issues or PRs currently assigned to the user.
- commenter:USERNAME – Items containing at least one comment from the user.
- involves:USERNAME – Broad match for any item the user authored, is assigned to, or commented on.
State, Status, and Metadata
- is:issue or is:pr – Scope results to issues or pull requests exclusively.
- state:open, state:closed, state:merged – Filter by lifecycle state (merged applies only to PRs).
- status:success, status:failure, status:pending – Filter PRs based on the Status API results, as documented in the cheat sheet's Filters section at
README.md#L28-L33. - review:required, review:approved, review:changes_requested – Target PRs by their review checkpoint.
Temporal Filters
- created:DATE – Supports ISO-8601 (
2023-01-01), relative ranges (>30d), or intervals (2023-01-01..2023-06-01). - updated:DATE – Items last modified before or after a specific date.
- merged:DATE – PRs merged within a date range (PRs only).
- closed:DATE – Items closed on or before a specified date.
Scoping and Organization
- repo:OWNER/REPO – Restrict search to a single repository (e.g.,
repo:tiimgreen/github-cheat-sheet). - org:ORG – Search across all repositories within an organization.
- label:LABEL or -label:LABEL – Include or exclude specific labels.
- milestone:"MILESTONE" – Filter by milestone title (quoted if spaces present).
- project:"PROJECT" – Filter by project board name.
Boolean Logic and Query Composition
Qualifiers chain with spaces to form logical AND operations. Negation uses the - prefix. For OR logic, repeat queries or use the OR operator within parentheses.
Example: To surface open bugs assigned to alice, created within 30 days, and explicitly not marked wontfix:
is:issue state:open label:bug assignee:alice created:>30d -label:wontfix
Advanced Filtering Use Cases
Triage: Pull Requests Awaiting Review
Identify incoming PRs that require attention while excluding your own submissions:
is:pr review:required -author:YOUR_USERNAME
Stale Issue Detection
Locate issues with no activity for 90 days to trigger maintenance workflows:
is:issue updated:<90d -label:up-to-date
Cross-Repository Reporting
Aggregate closed PRs merged after a specific date across an entire organization:
org:myorg is:pr state:closed merged:>2023-01-01
CI Status Gating
List only PRs that passed all continuous integration checks, leveraging the status:success qualifier implemented in README.md#L28-L33:
is:pr status:success -label:skip-ci
Programmatic Implementation
These queries integrate directly into GitHub's global search bar, the Issues/PR filter UI, or the Search API (GET /search/issues?q=…).
GitHub CLI (gh)
List open PRs requiring review in the current repository:
gh issue list --search "is:pr review:required state:open"
Display bugs reported in the last week:
gh issue list --search "is:issue label:bug created:>7d state:open"
Raw HTTP Requests
Query the Search API directly for successful PRs:
curl -H "Accept: application/vnd.github+json" \
"https://api.github.com/search/issues?q=is%3Apr+repo%3Atiimgreen%2Fgithub-cheat-sheet+status%3Asuccess+state%3Aopen&per_page=30"
Authentication via a personal access token is required for higher rate limits.
Batch Stale Issue Reporting
Aggregate stale issues across an organization's repositories:
#!/usr/bin/env bash
ORG="myorg"
DAYS=90
for REPO in $(gh repo list "$ORG" --json name -q '.[].name'); do
echo "⏳ $ORG/$REPO – stale issues (>$DAYS days no activity):"
gh issue list --repo "$ORG/$REPO" \
--search "is:issue state:open updated:<${DAYS}d" \
--limit 100
echo
done
Python Integration
Use requests to consume filtered results programmatically:
import os, requests
TOKEN = os.getenv("GH_TOKEN")
HEADERS = {
"Authorization": f"token {TOKEN}",
"Accept": "application/vnd.github+json"
}
query = "is:pr repo:tiimgreen/github-cheat-sheet status:success"
url = f"https://api.github.com/search/issues?q={query}&per_page=50"
r = requests.get(url, headers=HEADERS)
for pr in r.json()["items"]:
print(f"PR #{pr['number']}: {pr['title']} – {pr['html_url']}")
Summary
- GitHub's search supports 20+ qualifiers spanning identity, time, status, and organization scope.
- Boolean operators allow complex AND/OR logic and negation via the
-prefix. - The Status API qualifiers (
status:success, etc.) documented atREADME.md#L28-L33enable CI-driven filtering. - Queries work identically in the web UI,
ghCLI, and the REST Search API. - Date ranges support both ISO-8601 and relative syntax (e.g.,
>30d).
Frequently Asked Questions
How do I filter GitHub issues by multiple labels simultaneously?
Use space-separated qualifiers for logical AND, or the OR operator for alternatives. To find items labeled both bug and critical, use label:bug label:critical. For items with either label, use label:bug OR label:critical.
Can I exclude specific users from issue search results?
Yes. Prefix any user-based qualifier with - to negate it. For example, -author:dependabot excludes all items created by Dependabot, while -assignee:USERNAME shows only unassigned items when combined with state:open.
What is the difference between involves and author qualifiers?
author:USERNAME filters items created by that specific user only. involves:USERNAME casts a wider net, capturing items where the user is the author, assignee, or commenter, making it ideal for "show me everything related to this person" queries.
How do I search for pull requests that passed all status checks?
Use the status:success qualifier, which filters PRs based on the Status API results as documented in the cheat sheet's Filters section. Combine with is:pr and repository scoping: is:pr repo:owner/repo status:success.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →