github-labels-query

Lists GitHub repository labels with pagination and case-insensitive name filtering via the REST API.

5.1k|530|Updated Aug 12, 2025
One-click install
npx skills add https://github.com/github/gh-aw --skill github-labels-query
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-labels-query
Source: https://github.com/github/gh-aw/tree/main/.github/skills/github-labels-query
Command: npx skills add https://github.com/github/gh-aw --skill github-labels-query

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Retrieving GitHub repository labels with controlled page sizes and name-based filtering requires manual API calls and pagination handling, which is repetitive and error-prone when done by hand.

Core Features & Use Cases

  • Paginated Label Listing: Fetch labels from any GitHub repository with configurable per-page sizes (1-100) and page numbers.
  • Name Filtering: Filter labels by case-insensitive substring matching, automatically paging through all labels before applying the filter.
  • Structured JSON Output: Returns label details (id, name, color, description, default status) along with item count and pagination metadata.
  • Use Case: When triaging issues in a large repository, quickly find all labels containing "bug" to understand the existing labeling taxonomy before applying them.

Quick Start

List the labels in the github/gh-aw repository, filtered to names containing "bug" with 10 results per page.

Frequently Asked Questions about github-labels-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I list GitHub repository labels with pagination?

Run the query-labels.sh script with --owner and --repo arguments, optionally setting --per-page (1-100, default 10) and --page. It calls the GitHub REST API labels endpoint and returns JSON with labels, item count, and pagination info.

How to filter GitHub labels by name using the API?

Pass the --name-filter option with a substring to match label names case-insensitively. The script fetches all labels using gh api --paginate, filters them locally with jq, then applies the requested pagination to the filtered results.

What tools are required to query GitHub labels from the command line?

The script requires the GitHub CLI (gh) for authenticated API calls and jq for JSON processing. Both must be installed and gh must be authenticated with access to the target repository.

What is the maximum number of GitHub labels returned per page?

The per-page value must be between 1 and 100, matching the GitHub REST API limit. The script validates this range and returns an error if the value falls outside it.

Why does label filtering return fewer results than expected?

When --name-filter is used, pagination applies to the filtered subset, not the full label list. If your filter matches few labels, later pages may be empty; check page 1 first or broaden the filter substring.