fix(pepper): pre-create Pepper labels before applying them [DEV-237]#41
Conversation
Follow-up to the pepper-cooking lifecycle change. `gh pr edit --add-label "<name>"` does not auto-create labels — it errors with `"<name>" not found` when the label is missing from the repo. The new "Mark PR as cooking" step was failing on every consumer repo because `pepper-cooking` was a brand-new label nothing had created. Add an "Ensure Pepper labels exist" step (review mode only) that idempotently creates the four Pepper labels via `gh label create` with `2>/dev/null || true` to tolerate already-exists errors. This makes cold-start runs work in any repo and preserves per-repo color or description customization on labels that already exist. Refs: DEV-237
There was a problem hiding this comment.
Verified against DEV-237 (Linear) — aligned. The diff pre-creates the four Pepper labels before the cooking step tries to apply them, which fixes the label-not-found error that broke #39's lifecycle change in fresh repos. The || true fallback preserves per-repo customization when labels already exist. Test plan matches the risk (workflow infra doesn't need unit tests; smoke-test post-merge is the right move).
This one's clean, Ryan — the comment on lines 133-140 does exactly what a good comment should: it explains the why (gh doesn't auto-create labels on add, so we pre-create) and the how (|| true to avoid clobbering existing labels). Line 148's copper color for pepper-cooking is a nice touch.
— Pepper
When you're ready for another look, comment @pepper review.
Summary
Follow-up to #39 (the pepper-cooking lifecycle change). The new "Mark PR as cooking" step was failing on every consumer repo because
gh pr edit --add-label "<name>"does not auto-create labels — it errors with"<name>" not foundwhen the label is missing from the repo.This adds an "Ensure Pepper labels exist" step (review mode only) that idempotently creates the four Pepper labels via
gh label create, tolerating already-exists errors so per-repo customization of label color/description is preserved.Fixes the failure mode caught immediately after #39 merged. v1 has been rolled back to the pre-#39 commit (a8a48f6) to unblock consumers while this lands.
Refs: DEV-237.
Test plan
@pepper reviewto retrigger; this time the new lifecycle (label-ensure → cooking → swap) works end-to-end.