Skip to content

[SPN-2931] Pre-create repo labels in workflow (fixes 'quality-issues' not found)#27

Merged
drago1216 merged 1 commit into
mainfrom
aaronbarnes/SPN-2931-ensure-labels
May 29, 2026
Merged

[SPN-2931] Pre-create repo labels in workflow (fixes 'quality-issues' not found)#27
drago1216 merged 1 commit into
mainfrom
aaronbarnes/SPN-2931-ensure-labels

Conversation

@drago1216

Copy link
Copy Markdown
Contributor

Summary

Hotfix for #26. The first sdk-update run after merge died at the PR-create step:

```
'quality-issues' not found
```

`gh pr edit --add-label "a,b,c"` validates every label in its CSV against the repo's registered labels and fails the whole call if any one is missing. The `quality-issues` name was introduced in #26 but never created in the repo UI.

Fix

Add an idempotent "Ensure workflow labels exist" step before the PR-create step. Runs `gh label create --force` for each label name the workflow knows about (`auto-generated`, `breaking`, `generation-failed`, `quality-issues`).

`--force` makes it self-healing — creates if missing, updates color/description if present. Future label additions only need a code change here; no manual repo setup.

Also adds `issues: write` to the job's permissions (the labels API lives under issues, not pull-requests).

Test plan

  • Re-trigger `sdk-update.yml` and confirm: (a) "Ensure workflow labels exist" step succeeds, (b) PR-create step succeeds with the correct label set, (c) re-running doesn't error.

🤖 Generated with Claude Code

The last sdk-update run failed at the PR-create step:

  'quality-issues' not found

Root cause: `gh pr edit --add-label "a,b,c"` validates every label name
in its CSV against the repo's registered labels and fails the entire
call if any one is missing. We introduced the `quality-issues` name in
the previous PR (#26) but never created the matching label in the repo,
so the first run after merge died here.

Fix: add an "Ensure workflow labels exist" step that runs
`gh label create --force` for each label name the workflow knows about.
--force makes it idempotent (creates if missing, updates color/description
if present, exits 0 either way). Same step covers auto-generated,
breaking, generation-failed, and quality-issues so future additions are
self-healing — code change is enough, no manual repo setup required.

Also adds `issues: write` to the job's permissions block, since
`gh label create` hits the labels API which lives under issues, not
pull-requests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drago1216
drago1216 requested a review from a team as a code owner May 29, 2026 22:06
@drago1216
drago1216 merged commit cf1ff16 into main May 29, 2026
5 checks passed
@drago1216
drago1216 deleted the aaronbarnes/SPN-2931-ensure-labels branch May 29, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants