Label
Source:
src/GitHub/Label.ts
A GitHub repository label.
Label manages repository labels for categorizing issues and pull requests.
Labels are created on first deploy and updated in place on subsequent
deploys when properties change.
Authentication is resolved via the GitHubCredentials service supplied by
GitHub.providers() (env, stored PAT, gh CLI, or OAuth). The token needs
repo scope for private repositories or public_repo for public ones.
Creating Labels
Section titled “Creating Labels”Basic Label
const bug = yield* GitHub.Label("bug", { owner: "my-org", repository: "my-repo", name: "bug", color: "d73a4a", description: "Something isn't working",});Multiple Labels
yield* GitHub.Label("feature", { owner: "my-org", repository: "my-repo", name: "feature", color: "a2eeef", description: "New feature or request",});
yield* GitHub.Label("documentation", { owner: "my-org", repository: "my-repo", name: "documentation", color: "0075ca", description: "Improvements or additions to documentation",});Updating Labels
Section titled “Updating Labels”Deploy with the same logical ID and different properties to update the existing label in place.
yield* GitHub.Label("priority-high", { owner: "my-org", repository: "my-repo", name: "priority: high", color: "ff0000", description: "Updated: Critical issues requiring immediate attention",});Label Color Codes
Section titled “Label Color Codes”GitHub uses 6-character hex codes without the # prefix. Common colors:
d73a4a- Red (bugs)0075ca- Blue (documentation)a2eeef- Light blue (features)7057ff- Purple (good first issue)008672- Green (improvement)e4e669- Yellow (question)
const labels = [ { name: "bug", color: "d73a4a", description: "Something isn't working" }, { name: "enhancement", color: "a2eeef", description: "New feature" }, { name: "documentation", color: "0075ca", description: "Documentation" },];
for (const { name, color, description } of labels) { yield* GitHub.Label(name, { owner: "my-org", repository: "my-repo", name, color, description, });}Replacing on Name Change
Section titled “Replacing on Name Change”Changing the name creates a new label and deletes the old one.
// First deploy creates "wip"const label = yield* GitHub.Label("work", { owner: "my-org", repository: "my-repo", name: "wip", color: "fbca04",});
// Later deploy with same logical ID but different name replaces itconst label = yield* GitHub.Label("work", { owner: "my-org", repository: "my-repo", name: "in-progress", color: "fbca04",});Wiring with Other Resources
Section titled “Wiring with Other Resources”const repo = yield* GitHub.Repository("api", { owner: "my-org", name: "api", autoInit: true,});
yield* GitHub.Label("bug", { owner: repo.owner!, repository: repo.name!, name: "bug", color: "d73a4a",});