From 8bbe58841af438f8ea8582e79f72f842fae1391f Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Sun, 26 Apr 2026 08:29:53 +0200 Subject: [PATCH] fix: ensure autopublish labels exist before using them The first cron run failed because `gh issue create --label X` errors out when label X doesn't exist (rather than auto-creating it). This blocked both the status-issue creation and the failure-issue cascade, leaving no visible artifact on a failed run. Add an "Ensure labels exist" step using `gh label create --force`, which upserts and is idempotent on every run. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/blog-autopublish.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/blog-autopublish.yml b/.github/workflows/blog-autopublish.yml index 501cce9..37eb3b4 100644 --- a/.github/workflows/blog-autopublish.yml +++ b/.github/workflows/blog-autopublish.yml @@ -59,6 +59,16 @@ jobs: git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Ensure labels exist + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # `gh label create --force` upserts (creates or updates), so this + # step is idempotent and immune to a label being deleted manually. + gh label create autopublish --color 6c8cff --description "Auto-publish PR opened by the daily cron" --force + gh label create autopublish-status --color 22d3ee --description "Pinned status issue for the auto-publish cron" --force + gh label create autopublish-failure --color f87171 --description "Auto-publish workflow failed on this run" --force + - name: Scan drafts id: scan run: |