Repository navigation
Description
Status: ✅ Implementation complete — pending dev → main + cutover
All 5 phases landed on feature/issue-601-epic-centralize-workflows. Closing comments below; cutover runbook at the end.
What landed
Centralized workflows (new, on nemarDatasets/.github)
| Workflow | Trigger | Phase | PR |
|---|---|---|---|
run-enrichment.yml |
repository_dispatch[run-enrichment] from Worker /webhooks/github on README/dataset_description push |
1 (#602) | nemarDatasets/.github#5 + nemar-cli#605 |
run-version-doi.yml |
repository_dispatch[run-version-doi] from Worker /webhooks/github on v* tag push |
2 (#606) | nemarDatasets/.github#8 + nemar-cli#607 |
run-generate-archive.yml |
repository_dispatch[generate-archive] from Worker triggerArchiveGeneration() or run-version-doi's trigger-archive job |
3 (#608) | nemarDatasets/.github#10 + nemar-cli#609 |
run-bids-validation.yml |
repository_dispatch[run-bids-validation] from per-repo shim (PR/push events) |
4 (#610) | nemarDatasets/.github#12 + nemar-cli#611 |
run-pr-merge.yml |
repository_dispatch[run-pr-merge] from per-repo shim (PR merge) |
4 (#610) | nemarDatasets/.github#12 + nemar-cli#611 |
Per-repo workflows still shipped by deployWorkflows()
| Workflow | Reason | Notes |
|---|---|---|
bids-validation.yml |
shim — GitHub PR events fire only where the PR lives | ~30 lines, dispatches to .github |
pr-merge.yml |
shim (create-release) + inline (cleanup-staging) |
AWS staging cleanup stays inline; release-cutting dispatches to .github |
version-check.yml |
kept per-repo by design | ~50 lines of pure JSON-math, low churn, shimming saves nothing |
Worker changes
POST /webhooks/github— new endpoint atbackend/src/routes/webhooks.ts. HMAC-SHA256 verification viaverifyGitHubWebhookSignature(newbackend/src/services/webhook-signature.ts). Push-event filtering via two pure decision functions:shouldDispatchEnrichment(README/dataset_description on main/release branches) andshouldDispatchVersionDoi(v* tag pushes). Both exported and unit-tested in isolation.triggerEnrichmentRun,triggerVersionDoiRun,triggerArchiveGeneration(retargeted) — all dispatch tonemarDatasets/.githubviaCENTRAL_WORKFLOW_REPO.- Zenodo DOI idempotency guard in
handleZenodoVersionDoi— short-circuits a duplicate dispatch by checkingdataset_versionsfor an existing DOI before callingzenodo.createNewVersion. - 401 self-heal in
githubFetchWithRetry(lands separately as v0.8.32) — orthogonal to centralization but carries forward.
Cleanup tooling
scripts/strip-per-repo-workflow.ts— parameterized one-shot script.--workflow <name>selects the target;--issue <N>overrides the commit-message anchor. Defaults:llm-enrichment.yml(Phase 1: centralize llm-enrichment workflow #602),version-doi.yml(Phase 2: centralize version-doi workflow #606),generate-archive.yml(Phase 3: centralize generate-archive workflow #608) are anchored inWORKFLOW_ISSUE_MAP.nemar admin enrich(src/commands/admin.ts) — retargeted to dispatch the central workflow.
Operator cutover runbook
Run in this exact order. Steps are idempotent; rerunning is safe.
1. Confirm the dev → main PR has landed
v0.8.X tag exists on main, Worker has deployed. (Verified by curling https://api.nemar.org/webhooks/github — expect 401 {"error":"Invalid signature"} since the request lacks a signed body; that means the endpoint is live.)
2. Grant Checks: Read & write on the GitHub App (docs/guides/github-app-setup.md)
The Phase 4 central run-bids-validation.yml posts check-runs via the GitHub Checks API. The App's existing permission set does not include Checks:write. Re-accept the App permission update on both nemarOrg and nemarDatasets installations. Without this, bids-validation check-runs 403 silently.
3. Configure the GitHub App webhook URL (if not already done from Phase 1)
Point nemar-publish-bot at https://api.nemar.org/webhooks/github, subscribe to push events at minimum. Confirm the App webhook secret matches the Worker's GITHUB_WEBHOOK_SECRET.
4. Sweep the legacy per-repo workflows
cd /path/to/nemar-cli
bun run scripts/strip-per-repo-workflow.ts --workflow llm-enrichment.yml
bun run scripts/strip-per-repo-workflow.ts --workflow version-doi.yml
bun run scripts/strip-per-repo-workflow.ts --workflow generate-archive.ymlEach invocation loops the ~123 dataset repos at concurrency 5 and DELETEs the file. Idempotent — repos that don't have the file are reported [skp] and skipped.
5. Deploy the new shims to existing repos
nemar admin ci sync --allDrift-detects and overwrites bids-validation.yml + pr-merge.yml on each dataset repo with the new shim templates. The version-check.yml template is unchanged so no-op on that file.
6. Verify end-to-end
- Enrichment: push to
nm099999's README.md. Expect exactly one run ofrun-enrichment.ymlonnemarDatasets/.github(none on the dataset repo). - Version DOI: push a
v0.0.X-rc1tag onnm099999. Expect one run ofrun-version-doi.yml, which dispatchesrun-generate-archive.yml. - BIDS validation: open a test PR on
nm099999. Expect the shim's quick green check + aRun BIDS Validationcheck-run posted by the central workflow with the validator outcome. - PR merge: merge that test PR. Expect the shim's
dispatch-releasejob fires, centralrun-pr-merge.ymlcreates the tag + release, and the resulting tag push triggers the Phase 2 chain.
Out of scope (potential follow-ups)
- BIDS validator output shape verification: the central run-bids-validation.yml inherits the legacy jq filter for annex-pointer error filtering. Reviewer flagged that BIDS validator v2+'s
locationfield may be a nested object rather than a string. Confirm against a real validator output and update the filter if needed. - Per-validator-version pinning sync: the shim interpolates
VALIDATOR_VERSIONfrom the CLI'svalidator-version.jsonat template-deploy time. Bumping the pin requiresnemar admin ci sync --allto push the new value out. Worth a CI step that auto-syncs on pin bump. - Tighten Worker → run-enrichment race window: the source_hash guard makes duplicate enrichment a Stage-2 no-op, but two concurrent calls during the cutover window can race on the D1
enrichment_jsonUPDATE. Separate row-level WHERE clause is a small follow-up.
Phases
| # | Title | Sub-issue | PRs |
|---|---|---|---|
| 1 | Centralize llm-enrichment | #602 | nemar-cli#605, nemarDatasets/.github#5 + #6 |
| 2 | Centralize version-doi | #606 | nemar-cli#607, nemarDatasets/.github#8 |
| 3 | Centralize generate-archive | #608 | nemar-cli#609, nemarDatasets/.github#10 |
| 4 | Hybrid shim for bids-validation + pr-merge | #610 | nemar-cli#611, nemarDatasets/.github#12 |
| 5 | Final tidy + cutover runbook | (this issue) | (in epic→dev PR) |
Activity
feat(ci): add central run-enrichment workflow
feat(ci): add central run-version-doi workflow
feat(ci): add central run-generate-archive workflow
feat(ci): add central run-bids-validation + run-pr-merge workflows
docs(centralize): comments reference central workflows post-#601
review(epic): workflow-sync test slices dynamically after template-co…
feat(centralize): replace per-repo llm-enrichment with /webhooks/gith…
feat(centralize): replace per-repo version-doi with /webhooks/github …
feat(centralize): retarget triggerArchiveGeneration to nemarDatasets/…
feat(centralize): hybrid shim for bids-validation + pr-merge
Merge pull request #1072 from bruAristimunha/central-version-check