Docs / Bring your code
Mirror a GitHub repository
GitHub can take down a repository: a DMCA notice, a sanctions ruling, or a policy change is enough. A Forge mirror is a copy that nobody can take down:
- Refs and history metadata live on Dash Platform, signed by your identity. There is no moderation at the protocol level, so nobody can delete them.
- Pack bytes live in storage you control (your bucket or IPFS node), on Platform, or both. Every reader checks them against the hash recorded on-chain.
- Readers clone with
git clone dash://…or browse from a static web app. Neither needs a server run by the Forge project.
You do not have to move off GitHub. Keep working there, and let the mirror follow.
Which way
Both paths use the same import engine:
| Way | Who it is for | What runs |
|---|---|---|
| Forge Mirror Action | People with write access to the GitHub repository, including access to its workflow file and secrets | A GitHub Action follows pushes, releases and, optionally, issues and pull requests. It also reconciles daily, under a per-run spending cap. |
dg import | Anyone who may copy the source, for a one-time copy or re-runs on their own schedule | Your computer reads GitHub and signs and pays from dg's identity. |
The setup wizard helps with either path.
This guide covers:
- The setup wizard
- Before you start
- First import: code, issues, PRs and releases
- The Forge Mirror Action
- Keep it in sync without the Action
- Check the mirror
The setup wizard
Open forge.dashhq.org/mirror, or New → Mirror a GitHub repo in the header. It first asks Do you maintain the repo on GitHub? Choose automatic sync if you have write access, or the command line for a one-time copy or your own re-runs. The hosted site runs on testnet (Which network).
Automatic sync
You need a public GitHub repository you maintain and a Dash identity signed in to this tab. You can create the identity on the same page (Identity and keys). A wallet sign-in may ask your wallet to approve a repository write.
| Step | What happens | Written here |
|---|---|---|
| 2. GitHub repository | Your browser checks GitHub anonymously, shows its licence and the Git LFS limitation, and asks you to confirm your right to copy the content. Existing mirrors appear as claims and never block your own copy. | nothing |
| 3. Forge repository | Create a repository with a suggested name and a description naming the GitHub source, or reuse one of yours at no cost. | the repo, its owner and settings, about 0.002 DASH |
| 4. The GitHub Action | Choose Set it up now or Later. Later opens Your Forge repo is ready, with a link to the repo, commands to fill it using dg, and Set up the Action to continue. | nothing |
| 5. Where the Action stores git data | Pick a saved bucket, add one with the storage wizard, or use Dash Platform. Unlock this tab first if asked. A pasted-key tab can use Platform only. | nothing |
| 6. The runner key (optional) | Make one here registers a limited key with a budget and expiry, using your master key once. It is shown once as DASH_FORGE_KEY. Or choose Add DASH_FORGE_KEY yourself and use dg, signed in as the repository's owner. Wallet sign-ins use that option. | one identity update if made here, about 0.0003–0.0005 DASH |
| 7. The workflow file and its secrets | Add DASH_FORGE_KEY and any bucket secrets first. The wizard fills the workflow with code and releases by default. Issues and pull requests are optional and can cost more on a busy repository. Review the cap and pinned commit, then commit the file on GitHub. Unlock the tab if asked for its bucket settings. | nothing |
| 8. The first mirror run | The page checks Platform every 10 seconds until the branches change, then links to the repo. The Action's run is paid through its key, under its spending cap. | nothing |
Every Action step (5–8) has Not now. It opens the same ready card and keeps your answers. Set up the Action returns to the first unanswered Action step. Creating a runner key here, adding secrets and committing the workflow are optional: you can stop with a ready Forge repository.
From the command line
You need a public source for the page's GitHub check, permission to copy it, dg and git-remote-dash, the GitHub CLI signed in, and a funded identity for dg. You do not sign in to the web page. For a private source, follow Into a private repository.
After the GitHub check, Run it on your computer fills in commands for this network. Edit the Forge repo name, choose whether to copy issues and pull requests too, and set a spending cap (default 0.2 DASH). The page signs nothing. dg asks about the rights to copy, shows the estimate, and asks before writing. When the cap exceeds dg's default 0.25 DASH key budget, the sign-in command also raises that budget.
A repository filled from dg uses dg's own storage settings, not storage picked in this browser. Without your own storage configured for dg, git data goes to Platform. Set a profile with dg storage use <profile> --global first if you want your bucket instead. Re-running the import copies only changes. A repo with the same destination name is reused, replacing its branches and tags.
Resume
The Action path saves public answers in this browser per network and signed-in identity. A key is never saved. The command-line path keeps its source, name, issues choice and cap in the page address, so reloading or sharing it restores the settings. When signed out, the GitHub check runs again and waits for Continue. When signed in, the saved GitHub answer is reused. Start over clears the page's answers and its address parameters.
What the copy is. The mirror is a copy at the time of each run. Later edits and deletions on GitHub (a rewritten comment, a deleted issue) are not propagated, and imported issues, pull requests and comments stay on Dash Platform, which cannot delete them. Mirror only what you have the right to copy.
The wizard pins the Action to one Dash Forge commit, the one the site was built from (uses: PastaPastaPasta/dash-forge/action@<commit>), and sets install: 'source', so the Action builds the three tools from that same commit.
How long it takes. A timed run on devnet bonsia (2026-09-30) mirrored a small public repository (two commits) with Platform storage. The wizard's own steps took 16 seconds of machine time: the GitHub check, signing in, creating the repository, the runner key and the workflow. A person reading, typing and pasting needs a few minutes more. From the workflow commit to the first mirrored push took 3 minutes 50 seconds. Of that, compiling the tools took 3 minutes 9 seconds, because the wizard's workflow builds them from source (no release was published then; a workflow pinned to a release tag downloads them instead). Mirroring took under 30 seconds and spent 0.018 DASH, the Action's own up-front estimate. Counted from opening the page, the mirror was live after 6 minutes 11 seconds, and that included a two-minute fix made during the run. Later runs reuse a build cache: the run for the next push took 1 minute 41 seconds in all. (That run built the tools in its own workflow steps with rust-cache; the wizard now leaves the build, and its cache, to the Action.)
Before you start
For the Action, you need GitHub write access and a signed-in Dash identity as above. GitHub runs and builds the tools for you.
For command-line imports, you need:
dgandgit-remote-dashfordg import. The standaloneforge-importis optional. Build them from a source clone:cargo install --locked --path crates/forge-importadds the importer to the two it installs. Or the install script fetches all three from the latest release, withDASH_FORGE_BINARIES="dg git-remote-dash forge-import"set.- A funded identity, signed in with
dg auth newordg auth login(quick start, steps 2–3).dg importuses that stored key. The standaloneforge-importdoes not readdg's default: give it--identity <source>orDASH_FORGE_KEY, for exampleDASH_FORGE_KEY=keychain:dash-forge/testnet/<identity id>for the keydg authkeeps in the keychain (key sources). - The GitHub CLI, logged in with
gh auth login(orGH_TOKEN/GITHUB_TOKENin the environment). The importer reads issues, PRs and releases through it. - Optional but recommended: a storage profile for your own bucket (
dg storage add; see Bring your own storage), so that pack bytes do not go on Platform at ~0.33 DASH/MiB (Costs).
Network. Forge runs on testnet, the tools' default network, and comes to mainnet once Dash Platform v5 reaches it. See Networks.
Cost. A first import is mostly git data plus one document per issue, PR, comment and review. The Mirror Action's first live run of a small repository (
dash-faucet, packs on Platform) cost about 0.078 DASH; a repository with 2 PRs, 15 comments and 7 reviews cost 0.112 DASH. Re-runs pay only for what is new, and nothing when nothing changed.--dry-runprices your repository before you spend anything.
1. First import
forge-import (or dg import, the same engine) copies a GitHub repository into a forge-v2 repository: every branch and tag, the head of every open PR (as refs/mirror/pull/<n>/head, so imported PRs can be checked out; a closed PR's head is removed and its commits are not the mirror's to pay for), labels, issues and PRs with their comments, reviews and state (open, closed, merged, labels, draft), and releases (tag, title, notes, and each asset referenced by its GitHub URL and SHA-256; assets are not re-uploaded).
Long text. An issue, PR, comment, review or release whose text is longer than the 5,120-byte field (Dash Core's release notes, a long bug report) keeps its whole text, up to 256 KiB: the importer stores it as a repository artifact on the same storage policy as the packs (Platform when the policy names none), and the field holds its first part and a hidden line naming it (forge-v2.md §6.3). The estimate includes it. If the artifact cannot be stored (your storage refuses it), the text is cut to the field with a link to the source, as importers before this did, and the run warns. A longer text than 256 KiB is cut to that with a link. Releases an older importer mirrored with cut notes are left as they are: a run does not publish them again only to store their full notes.
Where the packs go. The importer pushes through git-remote-dash, so it follows the git config the helper reads. To keep packs off Platform, set the storage policy globally before you import:
dg storage use r2-main --globalThe estimate follows the same policy. With your own storage, the git part costs only the manifests and ref updates on Platform (measured at 0.0035–0.0041 DASH for a push of two or three refs; see Costs), not the pack's bytes, so a --max-spend sized for that is not refused. A policy that includes platform, or sets dash.platformFallback, is priced as Platform storage, because the pack may land there.
Log output. The importer prints its own warnings. The Platform SDK's reports of a failure forge-core recovers from (a write whose nonce another write by the same identity took, a transport retry) are not printed. A failure still ends the run with an error. To see every retry, set RUST_LOG=debug.
Always start with a dry run. It reads everything, compares it with what the destination already holds, and prints what it would write and what that would cost. It writes nothing:
forge-import alice/project --network testnet --dry-runThen run it with a spending cap:
forge-import alice/project --network testnet --max-spend 0.5 --state ./alice-project.sync.json --i-have-the-rightsBefore it writes: the rights acknowledgement. A mirror is permanent on Dash Platform and carries other people's words: commit authors' names and emails travel in the pack objects, and issues, PRs, comments and reviews carry their authors' logins and text. Platform cannot delete any of it, and an author's later edit or deletion on GitHub is not carried over. So a real run prints what it is about to publish, together with the licence GitHub reports for the source (MIT, none detected, or not reported) and, when it can tell, whether the source belongs to the account in use, and then needs your say-so: --i-have-the-rights, or a "y" typed at a terminal. With no terminal and no flag it refuses, naming the flag. --yes confirms the cost only; it is not the acknowledgement. A dry run needs neither. The run warns when the source has no licence or belongs to someone else (the account in use is gh's login, or FORGE_IMPORT_ACCOUNT when you set it). If you are not the owner and the licence does not allow it, do not mirror it. Dash Forge cannot take a mirror down; an owner's removal request can only be honoured on dashhq's hosted surfaces (docs/hosted-curation.md).
Git LFS. If the default branch's .gitattributes sets filter=lfs, the run warns that the mirror holds the LFS pointer files only: the large files stay on GitHub, and Dash Forge does not mirror LFS objects. The summary JSON says so too (lfsDetected).
Unlike git and dg, the standalone forge-import does not read the network dg auth recorded: without --network (or DASH_FORGE_NETWORK / DASH_FORGE_DEVNET_NAME) it uses testnet, which has no Forge deployment (E702). dg import alice/project takes the same core flags and uses dg's network and identity defaults.
Useful flags (see forge-import --help):
| Flag | Effect |
|---|---|
--repo <owner/name or name> | The destination. The default is the GitHub name, owned by you; it is created when missing. |
--sync code,issues,prs,releases,labels | What to mirror (default: all). |
--max-spend <DASH> | A hard cap. The importer refuses to start when the estimate exceeds it, and checks it again before every write against what the run has actually spent (the measured balance drop, not just the estimate), so it stops before the write that would cross it. The estimate is calibrated to stay an upper bound. Without --max-spend, the cap is the estimate the run prints (and asks you to confirm, unless --yes): a run never spends more than you approved, and one that would is stopped before that write; re-running prices what is left. |
--state <file> | Incremental state: the next run asks GitHub only for issues, PRs and comments updated since this run started. |
--dry-run | Price only. |
--include-label-definitions | A private destination only: mirror the label definitions too. Their names, colours and descriptions are not encrypted, so they are left out by default; the labels set on issues and PRs are encrypted either way. |
--limit <n> | At most n issues and PRs (the oldest), for a cheap trial. Only those items and their comments are read, so a trial on a repository with thousands of issues takes a few requests. |
--yes | No confirmation of the cost, for CI. |
--i-have-the-rights | You may publish the source's content: you own it, or its licence or its owners allow it. Required for a real run (see above); without it the run asks at a terminal and refuses elsewhere. |
--concurrency <n> | How many issues and PRs have their comments, reviews, labels and state written at once (default 8, at most 16). Issues and PRs themselves are always created one at a time, in GitHub's order, so their numbers match. 1 writes one document at a time. See large repositories. |
--summary-json <file> | Write the run summary (counts, spend, key budget) as JSON. forge-import only. |
--work-dir <dir> | Keep the bare git mirror between runs instead of a temporary directory. forge-import only. |
--network, --devnet-name, --identity | As for dg. DASH_FORGE_KEY may be a file path or an inline dfk1: key. |
Issues and PRs keep their GitHub numbers (Forge numbers issues and PRs separately, so each keeps its own). They are written by your identity, since GitHub users have no Dash identity: each opens with "Mirrored from github.com/alice/project#12 by @bob" and carries an imported record with the GitHub author, creation time and URL. Close, reopen, merge, label and draft changes are written as member events, so the importing identity must be a maintainer (or a writer, which cannot publish releases) of the destination.
Numbers on a mirror. Forge continues a mirror's numbering: after an imported #7761, the next issue opened on Forge is #7762, as on GitHub. That holds when the importing identity is the repo's owner or a maintainer, whose numbers clients trust; a writer's imported numbers get no such trust, and new issues start again from a low number. Because a mirror shares numbers with its source, an issue opened on the mirror can take a number the upstream project uses later. When the import meets such a number, it stores that one upstream item at the lowest free number instead (its header and imported record still name the GitHub number) and says so in the summary's warnings, for example "upstream issue #7762 stored as #16 (number taken on Forge): https://github.com/alice/project/issues/7762". GitHub gives issues and PRs numbers from one sequence, so that low number is one a PR has upstream, and later upstream issues keep their numbers. (From GitLab, where issues and merge requests are numbered separately and a full mirror leaves no gap, each later item moves by one instead, and each move is reported.) The New issue form on a mirror says this before you post.
Re-running is safe and cheap. What is already mirrored is decided on chain (by the GitHub URL recorded in each document), not by a local file. A re-run writes only what is new or changed, and costs nothing when nothing changed. An interrupted or capped run is finished by running it again; nothing is written twice.
How a run ends. The summary's status (and the exit code) says:
| Status | forge-import exit | dg import exit | Meaning |
|---|---|---|---|
ok / dry_run | 0 | 0 | Finished. |
partial | 4 | 1 (E106) | Finished, but some items were skipped (their number is taken in the destination, the destination refused them, another identity already mirrored them, or the optional push of open PR heads did not fit the cap or failed). counts.skipped, counts.gitSkipped and the warnings say which. When issues or PRs were skipped, the --state file does not advance, so the next run retries them. A skipped PR-heads push alone does not hold the state back: git data is compared with the destination on every run. |
cap_exceeded | 3 | 8 (E801) | Stopped before the write that would cross --max-spend. |
error | 1 | by error | Failed. What was spent before the failure is still reported. |
A run with --limit that left items out does not advance --state either, and warns: every run takes the same first n items, so a recurring job with --limit never reaches the rest. Use --limit for a trial only.
Refused history. The importer pushes through git-remote-dash, so a history holding an object git itself refuses (a .git look-alike path, a hostile .gitmodules) stops the push before anything is stored or paid for (E511). Old commits with malformed author or committer lines (a bad time zone, a broken email) are accepted, as a plain git clone accepts them; that needs git 2.44 or newer.
Importing in phases. A large repository can be imported in steps: the code first, then the issues and PRs, each with its own cap and state file:
forge-import alice/project --sync code,releases,labels --work-dir ./project.git --state ./project-code.sync.json --max-spend 100 --i-have-the-rights
forge-import alice/project --sync issues,prs,labels --work-dir ./project.git --state ./project-collab.sync.json --max-spend 5 --i-have-the-rightsRun the code pass first. A merged PR is recorded as merged only when a base tip already on chain contains its merge commit. A pass without code checks that itself and pushes nothing. It fetches the merged PRs' base branches from the source: into the --work-dir mirror when a code run left one there, or else commits only, into a temporary repository that is removed after the run (never inside --work-dir). If the base branch's tip on chain does not contain the merge yet, the PR is recorded as closed. The same happens when the base could not be fetched. The run warns for each such PR, the summary counts them (unprovedMerges), and --state keeps their numbers: the next run reads them again whatever changed, and turns each close into a merge once the code is on chain (one small event per PR; nothing else is written again). A PR whose base branch was deleted at the source can never be proved; it stays closed, and is not revisited. Nor can a PR mirrored before its base branch was on chain at all: a merge counts only into a base that was a branch when the PR was opened on Forge (forge-v2 §6), which is why the code must come first.
Release assets. A release lists its assets in at most 4,096 bytes, about 16 GitHub assets. When a source release has more, the importer keeps, in this order:
- checksum files (
SHA256SUMS,checksums.txt) and their signatures; - Linux x86-64 builds;
- Windows;
- macOS arm64;
- macOS x86-64;
- Linux arm64;
- source archives;
- everything else.
A signature or per-file checksum (<file>.asc, .sig, .minisig, .sha256, .sha512) is kept right after its file when it fits, and never without it; a checksum list such as SHA256SUMS.asc counts as a checksum file. The release's notes then end with a line saying how many assets are not mirrored, with a link to the source release, and the web shows it as "N more assets not mirrored". The summary counts them (assetsOmitted). The importer hashes up to 4 GiB of assets per run, newest releases first; an imported asset it has not hashed yet is shown as "not verified yet" with a link to its original on GitHub or GitLab, and a later run hashes it (assetsUnhashed). A release published on Forge itself never offers a file without a recorded hash. Mirroring every asset of a large release needs a contract change, proposed in release asset manifests.
Into a private repository
A private GitHub source must not be copied into a public destination. Set your own storage for dg as above. Sign the GitHub CLI in with access to the source, create a private Forge repository first (dg repo create project --private --network testnet), then pass its name with dg import github.com/alice/project --repo project --network testnet --max-spend 0.2. Confirm the rights and estimate in the terminal. Raise dg's key budget if the cap needs more than its remaining budget. See Private repositories for membership and encryption.
Into a private repository, releases are sealed (private repositories §16) and have no 4,096-byte limit: every asset is listed in an encrypted asset list. Each asset the importer can download from its public URL, within the same 4 GiB per run and 1 GiB per release (a release's files are held in memory while they are encrypted), is checked against the size and digest the source records, encrypted and stored on your own storage (the policy set above). The others are listed as links to the source until a later run seals them (assetsLinked). The download sends no token, so a private source repository's assets stay links. The source link, publisher and publish date are encrypted too. A private import with releases therefore needs storage of your own: without it, a release with assets is skipped and the run ends partial. Storage still shows each asset's exact size, which can identify the public release it mirrors, and the run warns about it.
Not mirrored. Edits to a title or body after the item was first mirrored, a PR's later retarget to another base, and a PR's later head moves (its headOid stays at the commit it was mirrored at; refs/mirror/pull/<n>/head follows the head while the PR is open). Reactions, milestones, assignees, projects and GitHub Discussions are not mirrored.
Large repositories
How the importer writes:
- Issues and PRs are created one at a time, in GitHub's order, each confirmed before the next, so their numbers follow GitHub's.
- Everything else on an item (its comments, reviews, labels and state) is written behind its creation, while later items are being created.
--concurrencyitems (default 8) are written at once, and each item's own documents stay in their order: comments, then reviews, then labels and state.
How long it takes. Timed on devnet bonsia (2026-09-30), importing the issues and PRs of dashpay/dash-network-deploy into two new repositories: 749 issues and PRs with 3,911 documents in all (1,097 comments, 1,301 reviews, 764 labels and state changes).
--concurrency 1 | --concurrency 8 (the default) | |
|---|---|---|
| Writing | 122.6 min (0.53 documents/s) | 38.1 min (1.71 documents/s) |
| Whole run, including about 10 minutes reading GitHub | 132 min | about 48 min |
| Spent (measured balance drop) | 3.164 DASH | 3.138 DASH |
- Speed: writing was 3.2 times as fast; the cost was the same.
- Interrupted run: the pipelined run was killed partway through by accident and then run again. The two passes together wrote every document once, and a sample of 47 items (including every item that was mid-write at the kill) matched the other mirror exactly.
- What limits it: issues and PRs are still created one at a time, so a repository with many issues and PRs and few comments gains least.
- dashpay/dash: about 74,000 documents. It took 10 to 28 hours one document at a time. From these rates, a pipelined import of it should take about 7 to 9 hours. This is an estimate, not a measurement.
Progress. Every 30 seconds the importer prints a progress line to stderr:
forge-import: progress: 412/749 issues and PRs placed (up to upstream #430), 405 complete (all of the first 398, through upstream #415); 2210 documents written, 1.874210 DASH spent; 9m30s- Complete: an item whose documents are all written.
- "all of the first N": every item up to that point is complete.
Interrupted runs. A run that stops (a crash, a network error, the spend cap) can leave a few dozen items created but not yet complete. Running it again finishes them: it reads each item's comments, reviews and state on chain and writes only what is missing, and it writes nothing twice.
Spend cap. --max-spend still holds. Each write reserves its estimate against the cap before it is signed, counting the writes still in flight. When the cap is reached, no further write starts; the writes already in flight finish and are counted in the summary.
--concurrency 1. This writes one document at a time, as earlier versions did. Use it when something else signs with the same identity at the same time, or when you measure each write's cost (RUST_LOG=forge_import::cost=debug selects it for you).
2. The Forge Mirror Action
The Forge Mirror Action runs forge-import from GitHub Actions. It pushes code and syncs issues, PRs, releases and labels incrementally. Each run is idempotent, so running it again writes nothing and costs 0, and each run has a cost cap. The Action's README covers every input and output, what is and is not synced, the job summary, and the security notes.
The CI secret
The Action signs with the DASH_FORGE_KEY repository secret (Settings → Secrets and variables → Actions → New repository secret). Do not give CI your main identity file. The file from the bridge holds your 12 words and your MASTER key, which is everything. Use one of these:
A limited runner key (best): one pasteable value,
dfk1:<network>:<identity id>:<key id>:<wif>. It can spend at most its budget, only on Forge, and only until it expires, and Platform enforces that at consensus. Making one needs your master key once. If you signed in with the identity file from the bridge, pass that file with--master:dg auth export --new-key --master dash-identity-<id>.json \ --budget 0.5 --expires 365d --format dfk1 --reveal-secrets -o runner.dfk1Without
--master,dgasks for your 12-word recovery phrase instead.dgonly reads the master key from the file: the key is not stored and CI never sees it.The file's one line is the secret. Paste it, then delete the file.
dg auth keys listshows the key, anddg auth keys disable <id>retires it.A CI-only identity file, stripped to the one signing key a push needs, the HIGH authentication key. The fields the tools need are kept, and every other secret is blanked:
jq '{network, identityId, mnemonic: "", identityKeys: [.identityKeys[] | select(.purpose == "AUTHENTICATION" and .securityLevel == "HIGH")], assetLockKey: {wif: "", publicKeyHex: "", derivationPath: ""}}' \ dash-identity-<id>.json > ci-identity.json jq '.identityKeys | length' ci-identity.json # must print 1Paste the file's contents as the secret, and set
allow-unlimited-key: 'true'on the Action's step: its keys have no budget, so the Action refuses an identity file without that input. This lowers the risk but does not remove it: a leaked HIGH key can sign documents and spend the identity's credits until you disable it. Better still, use a separate identity with a small balance, added to the repository as a maintainer (dg collab add <owner>/<repo> <ci identity id> --role maintainer; a writer works too, but cannot publish releases). Then a leak costs only that balance. See Identity and keys.
Add your storage secrets too, for example S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY (or PINNING_TOKEN).
The workflow
Save this as .github/workflows/forge-mirror.yml in the GitHub repository. Replace the commit, the owner id and the repository name, and the bucket settings (or use storage-kind: platform and drop the s3-* lines and the two S3_* secrets).
name: Forge mirror
on:
# Only people with write access can start these (issue and PR events: see below).
push: { branches: ['**'], tags: ['**'] }
release: { types: [published, edited] }
schedule: [{ cron: '17 3 * * *' }] # daily reconcile
workflow_dispatch:
concurrency: { group: forge-mirror, cancel-in-progress: false }
jobs:
mirror:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions: { contents: read, issues: read, pull-requests: read }
steps:
# A commit you have reviewed, built from source. Or pin a release (`action@v0.2.0`)
# and drop `install`: it installs that release's checksum-verified binaries.
- uses: PastaPastaPasta/dash-forge/action@<40-character commit>
with:
install: 'source'
repo: dash://<owner identity id>/<repo name>
network: testnet # Forge's network today (also the Action's default)
sync: code,releases
storage-kind: s3
s3-endpoint: https://<account>.r2.cloudflarestorage.com
s3-region: auto
s3-bucket: forge
s3-public-url: https://pub-9a1.r2.dev
cost-cap: '0.05'
env:
DASH_FORGE_KEY: ${{ secrets.DASH_FORGE_KEY }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}No actions/checkout step is needed: the Action keeps its own bare mirror of the GitHub repository and never runs code from it.
To mirror issues and pull requests too, add issues,prs to sync: the daily run picks them up. Anyone with a GitHub account can open one, and you pay to store it, so the workflow leaves out the issues, issue_comment and pull_request_target triggers that would start a paid run on every such event. The Action's README explains that opt-in and its risk.
Run it once with dry-run: 'true' from the Actions tab (workflow_dispatch) to see the estimate before you spend anything.
Before you copy it:
- Pinned to a release tag, the Action installs that release's
dg,git-remote-dashandforge-importwithinstall.sh: it checks each archive against the release'sSHA256SUMSand, withghsigned in, its build provenance attestation. The Action'sversioninput defaults to the release it was cut with, so@v<version>installs that version. - Build from source (works today). Pin a commit you have reviewed (all 40 characters) and set
install: 'source': the Action compiles the tools from the commit inuses:(Rust is preinstalled onubuntu-latest; the Action installs a pinned, checksummed protoc). The first build takes several minutes, and the Action caches the compiled dependencies for later runs (that cache is trusted like any other cache of your repository;build-cache: 'false'turns it off). This is what the setup wizard writes, because the site runsmaster, which can be ahead of the latest release..github/workflows/mirror-action.ymlis this repository's own live test of the Action. To build the tools in your own steps instead, put them onPATHand setinstall: 'false'. - Do not use
@master. The binaries run with your key, so following whatevermasterholds would hand the key to any future change there, andmaster's scripts run with the latest release's binaries, which can be older than they expect. - Forge runs on testnet (Networks). The Action's default network is the one the hosted site uses. Mainnet has no Forge deployment yet, so
network: mainnetfails until one is registered. - Anyone who can open an issue or a PR can make a run spend, up to
cost-capper event, until the key's budget or the identity's balance runs out. On a busy public repository, drop the event triggers and let the daily schedule do the work, or removeissues,prsfromsync. - Status.
ok,dry_runandpartialsucceed (partialwith a warning, since the next run retries;fail-on-partial: 'true'fails it).cap_exceededanderrorfail the step. The job summary shows what was written, the spend against the estimate, and the runner key's remaining budget and expiry. - Release assets are not copied. They are recorded by GitHub URL with a sha256: GitHub's digest when it reports one, otherwise one the importer computes by downloading the asset once (nothing is kept, and a re-run reuses the recorded hash). An asset that cannot be hashed is recorded without one, with a warning;
dg release downloadand the web refuse to hand out such an asset unverified. GitHub's download links cannot be read by a web page (no CORS), so the web's release page links to them directly and offers to check the downloaded file against the hash. - A merged pull request is recorded as merged when the mirror has pushed a tip of its base branch that contains the merge commit (usually the next run after the merge). A PR merged into a branch that is not mirrored, or was deleted, is recorded as closed. A PR an older import recorded closed becomes merged on the next run: the first run after upgrading
forge-importreads everything again, whatever its--statefile says (the state's scope carries a version,v2), so older items are revisited once. - If a run fails after some ref updates or a pack landed, the summary counts them (and warns); a re-run does not write or pay for them again.
The setup wizard writes this file for you, with the secrets and every input filled in.
3. Keep it in sync without the Action
Run the same import again whenever you like, from cron or another CI system, with the same --state file. It copies branches and tags (force-pushes and deletions included), plus new issues, PRs, comments, reviews, state changes, labels and releases. Nothing else is written.
# crontab -e: every 15 minutes, code and issues, never more than 0.02 DASH a run
*/15 * * * * DASH_FORGE_KEY=/srv/mirror/ci-identity.json forge-import alice/project --repo <owner id>/project --network testnet --state /srv/mirror/project.sync.json --work-dir /srv/mirror/project.git --max-spend 0.02 --yes --i-have-the-rights --summary-json /srv/mirror/last-run.jsonIf you only want code, plain git does it with no importer at all:
# once: git clone --bare https://github.com/alice/project /srv/mirror/project
cd /srv/mirror/project \
&& git fetch --prune --prune-tags origin '+refs/heads/*:refs/mirror/heads/*' '+refs/tags/*:refs/tags/*' \
&& DASH_FORGE_KEY=/srv/mirror/ci-identity.json git -c dash.confirm=never push --prune dash://<owner>/<repo> \
'+refs/mirror/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'The fetch copies GitHub's branches into a private refs/mirror/heads/ namespace, so git's own origin/HEAD pointer never reaches the mirror, and --prune-tags makes tag deletions on GitHub reach it too. dash.confirm=never tells the cost guard not to wait for a terminal; the push still prints its estimate and its actual charge. A plain push has no per-run cap, so keep that identity's balance small.
Use explicit refspecs, not git push --mirror. --mirror pushes every ref the local repository holds. A clone made with git clone --mirror holds GitHub's refs/pull/*, and each of those would become a paid ref update on the mirror. Push refs/heads/* and refs/tags/* as above. HEAD needs no push: the helper derives it from the repository's default branch and does not offer it to a push, and a push that names HEAD anyway writes nothing.
4. Check the mirror
git ls-remote dash://<owner>/<repo> # every branch and tag, as recorded on-chain
dg repo view <owner>/<repo> # refs, members, pack count and size, security policy
dg storage status <owner>/<repo> # does every recorded copy of every pack answer?On the web: https://forge.dashhq.org/<owner>/<repo>. Each imported issue and PR opens with a line naming its GitHub original and author.
Visitors can also put the GitHub address after the site's: https://forge.dashhq.org/github.com/<github owner>/<github repo> (or /gh/…) opens the mirror, and the rest of a GitHub path opens the same page of it (…/issues/12, …/tree/main/src). So does https://forge.dashhq.org/<github owner>/<github repo> when no Forge repo has that address. The web app finds the mirror by its description (… (mirror of github.com/<owner>/<repo>), which the import writes). When several repos claim to mirror the same GitHub repo, it lists them and lets the visitor choose, unless exactly one of them is featured on the site; with none, it offers to set one up.
If the page says Not indexed for browsing yet, the import stored the code but not its browse index; the import's summary says so as a warning. The repository still clones. To publish the index without storing the code again, run:
dg repo reindex <owner>/<repo> # shows the price first; the index is 36 bytes per objectIt reads the stored packs, builds their index locally and uploads only that, about a thirtieth of what the code cost: about 3.6 DASH quoted for dashpay/dash's 268,015 objects, whose code upload was 98 DASH. The index goes to Platform when the packs are there. When the packs live on your own storage, name it with --profile <name>[,<name>…] (as for dg repack); the index then costs only its manifest on chain. If the warning names dg repack instead, the index cannot be extended as it stands, and a repack rebuilds it.
To check that a branch's history on the mirror matches GitHub, compare its tip on both:
git clone dash://<owner>/<repo> from-forge
git -C from-forge rev-parse main
git ls-remote https://github.com/alice/project refs/heads/mainThe two ids must match. A commit id is a hash over the commit and everything it reaches, so equal ids mean identical history for that branch. Repeat for other branches and tags, or compare the full git ls-remote output of both. Verify Forge goes further.
Confirm the mirror is yours
Anyone can create a repository whose description says it mirrors your project, so Forge shows that claim as "Says it mirrors github.com/alice/project" until your project confirms it. To confirm it, add a file named .dash-forge.json to the root of your default branch on GitHub, listing the mirror's repo id:
{"mirrors":["<repo id>"]}forge-import prints the file after it creates a mirror, and on the mirror's page a maintainer sees a link that opens GitHub's new-file page with the file filled in. The repo id is on the repository's Settings page. List several ids to vouch for several mirrors.
Visitors can then press Check with GitHub on the mirror's page. Their browser reads the file from GitHub and compares GitHub's default branch with the mirror's, and the page says "Mirror of github.com/alice/project" with both results. The check is optional and asks github.com directly, so nothing is checked until a visitor asks. On the "Repo not found" page, mirrors their source lists come first once checked.
This page is docs/guides/mirror-a-github-repo.md from the Dash Forge repository, as of this build. View or edit it on GitHub