Repository navigation
Dogfood: run labelsync against its own labels from CI (GH-48) - #97
Merged
Merged
Conversation
`bug` and `enhancement` exist in every new GitHub repository, and this catalogue's own `type: bug` and `type: feature` are where they belong. Declaring them as renames rather than leaving them as prune candidates keeps a label's identity: a rename is a PATCH, so every issue and pull request already carrying the label still carries it, where a delete and a create would look the same in the label list and silently unlabel all of them. On specsnl/labelsync both entries are inert — the targets already exist, so the planner skips them — and that is what makes them worth committing: they are what migrates the next repository the catalogue covers instead of unlabelling its issues.
labelsync becomes its own first user. A pull request touching labels.yml gets `sync --dry-run --output=json`, which exits 2 and fails the job when the committed config and the live labels disagree; a merge to main and a weekly cron apply it. The scheduled run is the only trigger that ever sees a label somebody edited in the web UI, and it is a no-op whenever there is nothing to fix. The binary is built from the checkout rather than installed from a release, so the run exercises the labelsync in the commit under test. Two things the job does that the documented recipe does not, both because this workflow has to survive contexts a copied one need not: - It checks for the token first and annotates a warning rather than failing when it is absent. A fork's pull request never sees the secret, and a red X on every pull request until somebody creates it is worse than a loud skip. It is not a required status check for the same reason, and because `paths:` means it does not run on most pull requests at all. - Runs are serialised per ref and never cancelled: an apply halfway through its writes has to finish. The job is append-only. Pruning stays a deliberate manual act.
) The CI page's workflow now mirrors the one this repository runs, and says where the two deliberately differ. The PAT's rotation burden gets a section of its own: nothing can warn as the expiry approaches, because a token is an opaque string until a request is made with it, so the mitigation is a date written down and a scheduled-failure email nobody filters away. The GitHub App is recorded as the later option and why it can wait — an installation token is a fifth step in the same resolver, or a value handed to the first one, and either way it resolves to the same Token and no call site changes. The chain is what makes it a decision rather than a migration.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.github/workflows/labels.yml— labelsync becomes its own first user. A pull request touchinglabels.ymlgetssync --dry-run --output=json, which exits2and fails the job when thecommitted config and the live labels disagree; a merge to
main, a weekly0 6 * * 1cron, and aworkflow_dispatchapply it. The cron is the only trigger that ever sees a label somebody editedin the web UI.
GH_TOKENfromsecrets.LABELSYNC_TOKENat job level,permissions: contents: read,timeout-minutes: 30, serialised per ref and never cancelled. Append-only — no prune.labelsync in the commit under test.
renames:inlabels.yml—bug→type: bugandenhancement→type: feature. That isthe decision the issue's last box asked for: a rename is a
PATCH, so the label keeps its id andits issues, where a delete and a create would look identical in the label list and strip it from
all of them. Both entries are inert here — the targets exist, so the planner skips them — and that
is the point: they migrate the next repository the catalogue covers.
release_test.gouses for goreleaser: the threetriggers and their
paths, the dry-run check gated to pull requests, the apply not being a seconddry run and never pruning,
GH_TOKENcoming from the PAT secret, no--tokenand noGITHUB_TOKENanywhere,permissionsnarrowed tocontents: read, and a timeout long enough fora paced apply. Plus
TestCatalogue_MigratesGitHubsStockLabelspinning the two renames.usage/ci.mdmirrors the workflow this repository runs and says where the copyableversion differs, and gains a rotation burden section and a not a required status check section.
architecture/authentication.mdgains What CI resolves to, and what comes after it: the App as afifth step in the same resolver, which is what makes it a decision rather than a migration.
design.md§ CI integration is marked landed;usage/configuration.mdpoints at the live renames.Two things to know before merging
LABELSYNC_TOKENdoes not exist yet. Until it does the job annotates a warning and skipsrather than failing, and it is deliberately not a required status check: a fork's pull request
never sees the secret, and
paths:means the job does not run on most pull requests at all. A redX on every pull request until somebody creates the secret is worse than a loud skip.
The first apply will recolour three labels. Configured colours are reserved, and three stock
leftovers are sitting on them:
Every stock label here is unused (0 issues, 0 pull requests), so the tidier outcome is to remove
them once with
labelsync sync --mode prune --prune all, after which the apply is a clean no-op.That deletes live labels, so this branch does not do it.
Closes #48