diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 88284d4..beb6331 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -3,7 +3,7 @@ name: sync # per branch: main goes out to every copy, fast-forward only (a copy with commits of its own is reported, never # overwritten); the branches a copy is told to send back (claude/* from cloud sessions on GitHub) come in as PRs here, # and Time's council reviews and lands them like any other. Each copy's token is a secret named in sync.json and passed -# below; a copy without one is skipped. On a GitHub copy, turn GitHub Actions off: these workflows must run here only. +# below (a token for https, a deploy key for ssh); a copy without one is skipped. On a GitHub copy, turn GitHub Actions off: these workflows must run here only. on: push: branches: [main] @@ -27,9 +27,12 @@ jobs: with: sparse-checkout: .github/time persist-credentials: false + # a copy over SSH (a deploy key) needs the ssh client; the job image may not have it + - run: command -v ssh || (apt-get update -qq && apt-get install -y -qq --no-install-recommends openssh-client >/dev/null) - run: python3 .github/time/sync.py env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TIME_TOKEN: ${{ secrets.TIME_TOKEN }} # branches and PRs on the home go in as the `time` user SYNC_FORCE: ${{ inputs.force && '1' || '' }} - GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }} # github.com/teahubxyz/time: Contents read/write + GITHUB_MIRROR_KEY: ${{ secrets.GITHUB_MIRROR_KEY }} # github.com/teahubxyz/time: a deploy key with write access + GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }} # or a token, for a copy over https diff --git a/time/sync.json b/time/sync.json index a042f4c..31cea5f 100644 --- a/time/sync.json +++ b/time/sync.json @@ -1,7 +1,21 @@ { - "_about": "Copies of repos on other forges, kept in step by .github/time/sync.py (the sync workflow). Each repo has one home (this forge) and every branch one writer: the `out` branches go from the home to each copy, fast-forward only; a copy's branches matching its `import` patterns come back to the home as PRs. `token` names the secret holding the copy's token, never the token itself; a copy whose secret isn't set is skipped. A GitHub copy needs GitHub Actions turned off, since these workflows must only run here.", + "_about": "Copies of repos on other forges, kept in step by .github/time/sync.py (the sync workflow). Each repo has one home (this forge) and every branch one writer: the `out` branches go from the home to each copy, fast-forward only; a copy's branches matching its `import` patterns come back to the home as PRs. `token` (https) or `ssh_key` (a deploy key, for ssh/git@ URLs; host keys pinned) names the secret that holds the credential, never the credential itself; a copy whose secret isn't set is skipped. A GitHub copy needs GitHub Actions turned off, since these workflows must only run here.", "repos": [ - {"repo": "teahubxyz/time", "out": ["main"], - "copies": [{"name": "github", "url": "https://github.com/teahubxyz/time.git", "token": "GITHUB_MIRROR_TOKEN", "import": ["claude/*"]}]} + { + "repo": "teahubxyz/time", + "out": [ + "main" + ], + "copies": [ + { + "name": "github", + "url": "git@github.com:teahubxyz/time.git", + "ssh_key": "GITHUB_MIRROR_KEY", + "import": [ + "claude/*" + ] + } + ] + } ] }