Skip to content

feat(action): the GitHub Mirror Action - #31

Merged
PastaPastaPasta merged 6 commits into
masterfrom
feat/v2-mirror-action
Sep 26, 2026
Merged

PastaPastaPasta merged 6 commits into
masterfrom
feat/v2-mirror-action

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Summary

This PR adds the GitHub Mirror Action (UX spec §8). It is part 3 of 3 of PR G. It runs forge-import (#30) from GitHub Actions, so a repository's code, issues, PRs, releases and labels stay mirrored into Dash Forge. The relay is #27.

  • action/action.yml. A composite action with these inputs: repo, network/devnet-name, sync, storage (storage-kind s3 / ipfs-pinning / ipfs-api / platform, plus endpoint inputs), replicas, cost-cap, dry-run, fail-on-partial, github-repo, version/install, state-cache. Outputs: status, spent-dash, summary-json.
  • validate.sh. Checks the inputs up front: the repo spec, the network, a numeric cost cap, and storage inputs that fit the chosen kind.
  • mirror.sh.
    • Isolation: each invocation gets its own HOME/config dir and a storage profile from the inputs. Storage secrets come from env: and are never passed on argv.
    • Keys: DASH_FORGE_KEY can be an inline dfk1: limited key or a CI identity file. Every piece of it is masked with ::add-mask::.
    • What it runs: forge-import with --max-spend = cost-cap, --state, which is persisted via actions/cache when state-cache is set, and --summary-json.
    • Exit codes:
      • 3 (cap_exceeded) and 1 (error) fail the step.
      • 4 (partial) is a warning by default, since the next run retries the skipped items. fail-on-partial: 'true' makes it fail instead.
  • summary.sh. Turns the summary JSON into the job summary: what was written or would be written, spend against the estimate, the runner key's remaining budget and expiry, and the balance. It also emits annotations: not a limited key, key nearly used up, key expiring, each warning, and the error. Any input it can't parse is treated as an error, never as success.
  • test.sh and testdata/. Offline tests: the summary for every status (ok, dry_run, partial, cap_exceeded, error, and garbage input), exit-code handling (0, 4, 4 with fail-on-partial, 1, 3) through a stub forge-import, and input validation.
  • .github/workflows/mirror-action.yml.
    • static: actionlint, shellcheck and action/test.sh, on every trigger.
    • live: runs on workflow_dispatch and weekly, and needs the FORGE_MOUTAI_IDENTITY_OWNER secret. A probe job makes it show as skipped when the secret is absent. It mirrors PastaPastaPasta/dash-faucet into moutai mirror-ci-dash-faucet with Platform-stored packs, then runs the Action again. The second run must report ok, write nothing and spend 0.
  • Docs. docs/guides/mirror-a-github-repo.md points at the Action, with a warning that anyone who can open an issue or PR can make a run spend, up to cost-cap per event. The Action README covers the statuses, exit codes and what is not mirrored. e2e/README.md reserves mirror-ci-dash-faucet.

The Action has no forge-v1 paths. Per the owner decision, everything v1-like was removed; the only matches were an example release tag and a note about the Action's own @v1 tag, and both were reworded.

Verification

Gaps

  • Live CI job not yet run: it needs FORGE_MOUTAI_IDENTITY_OWNER configured in this repository's secrets, and a workflow_dispatch after merge.
  • No release published yet: the default install: 'true' has nothing to download. The live workflow builds the binaries itself; the guide explains how to do the same.
  • Spend from untrusted events: event triggers let anyone who can open an issue or PR spend up to cost-cap per event. The guide recommends the daily schedule alone for busy public repositories, and a limited runner key.

🤖 Generated with Claude Code

PastaPastaPasta and others added 5 commits September 26, 2026 16:10
Composite action in action/ that validates inputs, installs the pinned release (or uses binaries on PATH), materializes DASH_FORGE_KEY (dfk1 or identity JSON), configures storage via step-scoped git config, runs forge-import under a cost cap and renders a job summary with key-budget/expiry warnings. mirror-action.yml runs actionlint, shellcheck and action/test.sh on PRs and a live devnet mirror of dash-faucet twice (second run must write nothing) on dispatch/schedule/master.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Per-invocation temp dir (no stale state/summary/work dir across mirrors in one job), summary.sh writes outputs first and never fails the job on schema drift, state is saved only after a successful real run, the git work dir is removed at the end, sync/devnet-name validation is whole-string, the live test avoids the nightly's signing window and checks counts strictly, and the README warns that public events can spend the key budget.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rt's

Replace the guide's 'coming soon' section with the real workflow (uses: PastaPastaPasta/dash-forge/action@master, install 'false' until a release exists). Drop the dash.confirm/costWarnThreshold git config: forge-import enforces --max-spend per write and prices its pushes itself.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
summary.sh accepts status partial (heading 'updated with skipped items', a Skipped row from counts.skipped, a warning annotation) and labels spend as 'Spent'. mirror.sh runs forge-import without exec: exit 4 is a warning unless the new fail-on-partial input is true; 1 and 3 still fail the step. README documents statuses, exit codes and what is not mirrored.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
forge-v1 compatibility is gone project-wide. The Action never had v1 or migrate paths; this renames the fixture release tag and rewords the future @v1 action-tag note so a v1 sweep finds nothing here.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4a320243-6241-4487-a380-0c36ea5aaa04

📥 Commits

Reviewing files that changed from the base of the PR and between 7b17359 and 3622192.

📒 Files selected for processing (15)
  • .github/workflows/mirror-action.yml
  • action/README.md
  • action/action.yml
  • action/mirror.sh
  • action/summary.sh
  • action/test.sh
  • action/testdata/cap-exceeded.json
  • action/testdata/dry-run.json
  • action/testdata/error.json
  • action/testdata/garbage.json
  • action/testdata/ok.json
  • action/testdata/partial.json
  • action/validate.sh
  • docs/guides/mirror-a-github-repo.md
  • e2e/README.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta
PastaPastaPasta merged commit 764f671 into master Sep 26, 2026
7 checks passed
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.

1 participant