Registry / devops / issue-labels

issue-labels

JSON →
library1.2.0jsnpmunverified

A utility for fetching and parsing GitHub issue labels programmatically. Version 1.2.0 ships with TypeScript definitions and supports both ESM and CommonJS. Uses GitHub's API to retrieve labels for any public or private repository. Lightweight with zero runtime dependencies beyond Node.js built-ins and optional GitHub authentication via token. Differentiated by its simple API and thorough TypeScript support compared to raw octokit usage.

npm install issue-labels
INSTALL
IMPORT
SIG · ISSUE-LABELS
I
issue-labels
devopsjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getLabels
import { getLabels } from 'issue-labels'
const getLabels = require('issue-labels').getLabels
Named export. Requires ESM or a bundler that handles Node.js exports field.
getLabel
import { getLabel } from 'issue-labels'
import getLabel from 'issue-labels'
Named export for fetching a single label. Not a default export.
GitHubLabel
import type { GitHubLabel } from 'issue-labels'
import { GitHubLabel } from 'issue-labels'
Type-only import required as GitHubLabel is a TypeScript interface, not a runtime value.

Fetches all labels from the public 'octocat/Hello-World' repo using a GitHub token from environment variable.

import { getLabels } from 'issue-labels'; async function main() { try { const labels = await getLabels('octocat/Hello-World', { auth: process.env.GITHUB_TOKEN ?? '' }); console.log(labels); } catch (error) { console.error(error); } } main();
Debug
Known issues
gotchaWithout providing a `auth` token, the package makes unauthenticated requests to GitHub API (60 requests/hour limit).
fix
Provide a personal access token via the `auth` option: `{ auth: process.env.GITHUB_TOKEN }`.
affects: >=0.0.0
gotchaThe `repo` parameter must be in the format 'owner/repo'. Passing only 'repo' or full URL will cause a 404.
fix
Ensure string matches 'owner/repository-name' pattern exactly.
affects: >=0.0.0
breakingVersion 2.0.0 will drop support for Node.js <18 and switch to native fetch, removing node-fetch dependency.
fix
Upgrade Node.js to 18+ before v2 release.
affects: <2.0.0
Errors
Common errors & fixes
TypeError: getLabels is not a function
Incorrect import: using default import instead of named import.
fix
Use `import { getLabels } from 'issue-labels'` instead of `import getLabels from 'issue-labels'`.
Error: 401 Unauthorized
Invalid or expired GitHub token provided in auth option.
fix
Generate a new token at https://github.com/settings/tokens with repo scope for private repos.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
node-fetchoptionalUsed for HTTP requests to GitHub API in environments without native fetch (Node <18). Optional if using Node 18+ or global fetch polyfill.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources
issue-labels — npm install issue-labels · libregistry