Skip to content

Merge pull request #30 from RegardsKiki2/claude/how-to-save-world-rev… #22

Merge pull request #30 from RegardsKiki2/claude/how-to-save-world-rev…

Merge pull request #30 from RegardsKiki2/claude/how-to-save-world-rev… #22

Workflow file for this run

name: Mirror to public repo
# Development happens in this private repo; the public home is
# HowToSaveTheWorld. On every push to main, sync the full working tree
# there as a single clean commit (same message as the triggering
# commit). The public repo carries no pre-release history.
#
# Requires a MIRROR_TOKEN secret: a fine-grained personal access token
# with Contents: Read & write on the public repo.
on:
push:
branches: [main]
workflow_dispatch:
env:
PUBLIC_REPO: RegardsKiki2/HowToSaveTheWorld # update after org transfer
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Check out development main
uses: actions/checkout@v4
- name: Clone public repo
env:
MIRROR_TOKEN: ${{ secrets.MIRROR_TOKEN }}
run: |
if [ -z "$MIRROR_TOKEN" ]; then
echo "::warning::MIRROR_TOKEN secret not set - skipping mirror"
exit 0
fi
git clone --depth 1 "https://x-access-token:${MIRROR_TOKEN}@github.com/${PUBLIC_REPO}.git" /tmp/public
- name: Sync working tree
run: |
[ -d /tmp/public ] || exit 0
find /tmp/public -mindepth 1 -maxdepth 1 -not -name .git -exec rm -rf {} +
git archive HEAD | tar -x -C /tmp/public
cd /tmp/public
git config user.name "Claude"
git config user.email "noreply@anthropic.com"
git add -A
if git diff --cached --quiet; then
echo "Public repo already up to date"
exit 0
fi
MSG="$(cd "$GITHUB_WORKSPACE" && git log -1 --pretty=%s)"
git commit -m "$MSG"
git push