Files
swaitsandClaude Fable 5.2 25f62d0401
Mirror to forge / mirror (push) Waiting to run
Validate / validate (push) Canceled after 0s
Validate / site (push) Canceled after 0s
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 <noreply@anthropic.com>
2026-11-13 14:02:39 -07:00

39 lines
1.3 KiB
YAML

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"