Skip to content

fix(workflows): prerelease workflow fails when autorelease: prerelease label does not exist #805

@WilliamBerryiii

Description

@WilliamBerryiii

Bug

The Pre-Release Companion workflow (prerelease.yml) fails on first-time PR creation because gh pr create --label "autorelease: prerelease" requires the label to already exist in the repository. If it doesn't, the step fails with:

could not add label: 'autorelease: prerelease' not found
Error: Process completed with exit code 1.

Root Cause

The gh pr create CLI command does not auto-create labels — it expects them to already exist. The workflow has no step to ensure the label exists before using it.

Additionally, the gh pr edit path (for updating an existing PR) never applies the label at all, so if the PR was created before the label existed, or the label was removed, it won't be re-applied on subsequent updates.

Fix

  1. Add an "Ensure pre-release label exists" step before the PR create/update step that idempotently creates the label using gh label create ... 2>/dev/null || true.
  2. Add --add-label "autorelease: prerelease" to the gh pr edit path so the label is consistently applied on updates too.

Related

No other workflows use --label with gh CLI commands, so this is the only instance of this pattern in the repository.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions