Repository navigation
feat(ci): add central run-enrichment workflow - #5
Merged
Merged
Conversation
Closes #4. Centralizes the per-repo llm-enrichment.yml (currently in 123 dataset repos) into a single shared workflow. Mirrors generate-manifest.yml structure (#1) — repository_dispatch[run-enrichment] + workflow_dispatch entry points, per-repo App token via actions/create-github-app-token@v1, identical Worker round-trip + rebase-retry commit semantics. Phase 1 of nemarOrg/nemar-cli#601.
3 of 7 tasks
Code-review findings: 1) curl call had no --connect-timeout or --max-time, so a hung TLS handshake or stalled Worker could pin the runner for the full 20-min timeout-minutes budget. Match generate-manifest.yml's pattern with --connect-timeout 10 --max-time 180. 2) Add explicit job-level permissions:{} to zero out the default GITHUB_TOKEN scope; the push uses a per-repo App installation token, the default token is never used and shouldn't carry implicit write.
neuromechanist
added a commit
that referenced
this pull request
May 23, 2026
Closes #7. Phase 2 of nemarOrg/nemar-cli#601. Sibling to #5 (run-enrichment.yml). Lifts the per-repo version-doi.yml into a single shared workflow. Triggered by repository_dispatch[run-version-doi] from /webhooks/github tag-push handler (lands in nemarOrg/nemar-cli#606).
This was referenced May 23, 2026
neuromechanist
added a commit
that referenced
this pull request
May 23, 2026
Closes #9. Phase 3 of nemarOrg/nemar-cli#601. Sibling to #5 (run-enrichment) and #8 (run-version-doi). Lifts the per-repo generate-archive.yml template — already repository_dispatch-driven so the Worker just retargets the dispatch URL.
neuromechanist
added a commit
to nemarOrg/nemar-cli
that referenced
this pull request
May 23, 2026
…ub dispatch Closes #602. Phase 1 of epic #601. Removes the per-repo .github/workflows/llm-enrichment.yml that shipped to 123 dataset repos via deployWorkflows() and replaces it with: - A new Worker endpoint POST /webhooks/github that receives GitHub App push events, HMAC-verifies the signature, filters to nemarDatasets dataset repos pushing README.md/dataset_description.json/.nemar/ metadata.json on main or release/** branches, and fires repository_dispatch[run-enrichment] at nemarDatasets/.github. - A new triggerEnrichmentRun() helper mirroring triggerManifestGeneration(). - A new webhook-signature service implementing HMAC-SHA256 verification with a constant-time compare (no crypto.timingSafeEqual on Workers). - The central run-enrichment.yml workflow lives on nemarDatasets/.github (see nemarDatasets/.github#5). It mints a per-repo App token scoped to the target dataset_id, checks out the dataset repo at the given ref, and reuses the same Worker round-trip + retry contract as the legacy per-repo workflow (#599). Tests added: webhook-signature.test.ts (11 cases), trigger-enrichment.test.ts (4 cases), webhook-github-push.test.ts (19 cases) covering the dispatch filter table. workflow-yaml.test.ts updated to assert the template is no longer shipped. Cutover script: scripts/strip-per-repo-llm-enrichment.ts deletes the legacy file from every dataset repo. Idempotent. Operator runs once after the App webhook URL is pointed at the new endpoint.
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.
Closes #4. Phase 1 of nemarOrg/nemar-cli#601.
What
New
.github/workflows/run-enrichment.yml— central LLM-metadata enrichment workflow for NEMAR datasets. Mirrorsgenerate-manifest.yml(#1).repository_dispatch[run-enrichment]from the new Worker endpointapi.nemar.org/webhooks/github(lands in Phase 1: centralize llm-enrichment workflow nemarOrg/nemar-cli#602).workflow_dispatchwithdataset_id,ref,forceinputs for manual recovery and smoke-tests.https://api.nemar.org/webhooks/llm-enrichwith the retry contract from feat(workflow): retry HTTP 5xx and fail loud in llm-enrichment.yml nemarOrg/nemar-cli#599: 3 attempts, 5/10/15s linear backoff, 4xx terminal (401 carve-out), exit 1 on persistent failure..nemar/metadata.json+.bidsignoreback to the target dataset repo withgit pull --rebaseretry loop for the cutover window where the old per-repo workflow may briefly co-fire.Why
llm-enrichment.ymlcurrently ships per-dataset-repo, so every fix forks 123-way (just hit this twice: #596 stale-token, #598 silent failure). The OpenNeuro mass-import will multiply that surface. Centralization is the proven pattern from manifest (#564) — one workflow, one fix point, dataset repos stay pristine.Ship order
.github(idle, no caller yet)./webhooks/githubendpoint that firesrepository_dispatch run-enrichmenthere.https://api.nemar.org/webhooks/github. One-time operator action.llm-enrichment.ymlfrom all 123 dataset repos via the cleanup script in #602.Between (3) and (4) both workflows briefly fire on the same push; the Worker's
source_hashguard makes the duplicate a Stage-2 no-op, and the workflow's rebase loop handles git commit races. Window is short and bounded.Test plan
After merge:
gh workflow run run-enrichment.yml --repo nemarDatasets/.github -f dataset_id=nm099999 -f force=true gh run watch curl -s https://api.nemar.org/datasets/nm099999 | jq .dataset.enrichment_jsonExpect: green run,
enrichment_jsonpopulated in D1,.nemar/metadata.jsoncommitted tonemarDatasets/nm099999@main.