From 25f62d04013c1aa62153563b7464f75788a0fb4c Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 13 Nov 2026 14:02:39 -0700 Subject: [PATCH] Pass changes merged on GitHub on to the forge A workflow pushes every push to main on GitHub to the primary repository at git.swaits.com, so a pull request merged on GitHub reaches both without anyone pulling it by hand. It uses a deploy key that can write to that one repository, checks the forge's host key, and never forces: if the two have diverged it fails. CONTRIBUTING.md names the forge repository. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/mirror.yml | 38 ++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/mirror.yml diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 0000000..b177486 --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,38 @@ +name: Mirror to forge + +# The maintainer's own forge (git.swaits.com) holds the primary repository and +# this GitHub repository mirrors it. Pull requests are merged here, so every +# push to main is passed on to the forge. A push that came from the forge is +# already there and changes nothing. The push is never forced: if the two have +# diverged this job fails and a person sorts it out. + +on: + push: + branches: [main] + +concurrency: + group: mirror-to-forge + cancel-in-progress: false + +permissions: + contents: read + +jobs: + mirror: + if: github.repository == 'swaits/longhikes' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Push main to the forge + env: + FORGE_SSH_KEY: ${{ secrets.FORGE_SSH_KEY }} + FORGE_KNOWN_HOSTS: ${{ secrets.FORGE_KNOWN_HOSTS }} + run: | + install -m 700 -d "$HOME/.ssh" + printf '%s\n' "$FORGE_SSH_KEY" > "$HOME/.ssh/forge_key" + chmod 600 "$HOME/.ssh/forge_key" + printf '%s\n' "$FORGE_KNOWN_HOSTS" > "$HOME/.ssh/forge_known_hosts" + export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/forge_key -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/forge_known_hosts -o StrictHostKeyChecking=yes" + git push ssh://git@git.swaits.com:2222/swaits/longhikes.git "$GITHUB_SHA:refs/heads/main" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d06bf51..b0d56c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ Thank you for helping correct or extend this dataset. Please keep changes small: ## How to send a change -Issues and pull requests are taken at https://github.com/swaits/longhikes. That repository mirrors the maintainer's own; a change accepted there reaches both. +Issues and pull requests are taken at https://github.com/swaits/longhikes. That repository mirrors the maintainer's own, https://git.swaits.com/swaits/longhikes; a change accepted on GitHub is passed on to it automatically. - You do not need git to report something. Every trail's page on https://longhikes.org has a "Report a problem" link that opens a short form, and the repository's issue forms cover a wrong record, a missing trail, and a request from a steward or creator to remove or re-credit a track or a logo. - To fix a record yourself, use "Edit this record" on the trail's page, or edit `/trail.toml` in a fork, and open a pull request. Say where each changed fact can be checked.