Skip to content

Phase 3: centralize generate-archive workflow #608

Closed

Description

@neuromechanist

Sub-task of #601. Phase 3 of the centralization epic.

Scope

Move generate-archive.yml from the per-repo deployWorkflows() set to a single shared workflow on nemarDatasets/.github. The workflow is already repository_dispatch-driven, so this is the lowest-friction phase — no Worker push-handler changes, just a retarget of the dispatch URL.

Deliverables

1. Central workflow — nemarDatasets/.github/.github/workflows/run-generate-archive.yml

Lifts the existing per-repo generate-archive.yml template body.

  • Trigger: repository_dispatch[generate-archive] + workflow_dispatch (manual recovery with dataset_id + version inputs).
  • Validates dataset_id shape against nm|on|xx + 6 digits (mirrors Phase 1/2 guards).
  • Mints per-repo App token scoped to client_payload.dataset_id.
  • Checks out the target dataset repo at the version tag (v$VERSION). Required because git-annex pointer resolution needs the dataset's tree.
  • Same npm install + archiver streaming script as the legacy template, same AWS upload.
  • permissions: {} at the job level (defense-in-depth, matches Phases 1/2).

2. Worker — triggerArchiveGeneration retarget

Currently in backend/src/services/github.ts:2179 the helper dispatches against ${ORG_NAME}/${repo} (i.e. the dataset repo itself, where the per-repo workflow listens). Change to target ${CENTRAL_WORKFLOW_REPO} instead and put dataset_id in the payload alongside the existing version + public fields.

3. Strip per-repo template

In backend/src/services/github.ts:

  • Delete the generateArchive template string.
  • Remove .github/workflows/generate-archive.yml from getWorkflowTemplates().
  • Update test/workflow-yaml.test.ts to drop generate-archive-specific assertions (the archiver-pin test).

4. Update run-version-doi.yml (Phase 2 sibling)

The Phase 2 run-version-doi.yml ends with a trigger-archive job that dispatches event_type=generate-archive against repos/nemarDatasets/$DATASET_ID/dispatches. Retarget to nemarDatasets/.github/dispatches with client_payload.dataset_id added.

5. One-time cleanup

bun run scripts/strip-per-repo-workflow.ts --workflow generate-archive.yml once the central workflow lands and the dispatch is redirected. Add generate-archive.yml: '<issue-number>' to the script's WORKFLOW_ISSUE_MAP.

6. Tests

  • New: test/trigger-archive.test.ts — fake-GitHub fixture asserts the outbound dispatch now targets nemarDatasets/.github with event_type=generate-archive and client_payload.dataset_id.
  • Update existing tests that referenced generate-archive.yml in the per-repo template set.

Ship order

  1. (nemarDatasets/.github PR) Central workflow lands.
  2. (this PR) Worker retarget + template strip + run-version-doi.yml update.
  3. Strip script removes per-repo generate-archive.yml from all 123 dataset repos.
  4. Verify: trigger a tag push on nm099999 (re-runs the full DOI + archive chain); expect one central run-version-doi run + one central run-generate-archive run, no per-repo runs.

Out of scope

  • PR-triggered workflows (Phase 4).
  • Final cleanup (Phase 5).

Activity

  1. added
    feature
    on May 23, 2026
  2. added a commit that references this issue on May 23, 2026
    d3df7d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions