Skip to content

add_labels.cjs only fetches first page of labels (pagination bug) #23914

@yskopets

Description

@yskopets

Summary

add_labels.cjs (used in the Process Safe Outputs job) fails to find labels that exist in the target repository because it only fetches the first page (≤100) of labels from the REST API.

Observed behavior

When a repository has more than 100 labels, the script logs:

Could not find label IDs for: done-by-agentic-workflow, done-by-claude-code, automation, qa
These labels may not exist in the repository. Available labels: bug, docs, duplicate, ...

The "Available labels" list ends at exactly 100 entries — the page 1 limit of GET /repos/{owner}/{repo}/labels. Labels that exist beyond page 1 are silently skipped and treated as non-existent.

Root cause

The label ID lookup fetches /repos/{owner}/{repo}/labels without paginating through all pages, so only the first 100 labels are considered.

Suggested fix

Either:

  1. Paginate through all pages before building the label name→ID map, or
  2. Look up each label individually via GET /repos/{owner}/{repo}/labels/{name} instead of listing all labels upfront

🤖 Reported with Claude Code

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions