Files
server-infra/.gitea/workflows/sync-checkout.yml
westfarn d9d2dc246a
Sync runner checkout / sync (push) Successful in 7s
Add Gitea workflow to sync runner checkout on master changes (#2)
## Summary

Implements #1: Gitea Act workflow that fast-forward pulls `~/Documents/repos/server-infra` on the self-hosted runner whenever `master` changes.

- Adds `.gitea/workflows/sync-checkout.yml`
- Triggers on direct push to `master` and on merged PRs targeting `master`
- Refuses to pull if the working tree is dirty
- Documents the workflow in `IMPLEMENTATION.md`

## Test plan

- [ ] Merge PR → workflow runs on self-hosted runner
- [ ] Runner checkout at `/home/westfarn/Documents/repos/server-infra` advances to latest `master` commit
- [ ] Dirty working tree on runner causes workflow to fail (no silent overwrite)
- [ ] Direct push to `master` also triggers sync

Closes #1

Reviewed-on: #2
2026-07-11 09:58:14 -07:00

37 lines
884 B
YAML

name: Sync runner checkout
on:
push:
branches: [master]
pull_request:
types: [closed]
branches: [master]
jobs:
sync:
if: gitea.event_name == 'push' || gitea.event.pull_request.merged == true
runs-on: self-hosted
steps:
- name: Pull latest server-infra
run: |
set -euo pipefail
REPO="/home/westfarn/Documents/repos/server-infra"
if [[ ! -d "${REPO}/.git" ]]; then
echo "Missing git checkout at ${REPO}"
exit 1
fi
cd "${REPO}"
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "Working tree is dirty; refusing to pull"
git status --short
exit 1
fi
git fetch origin master
git checkout master
git pull --ff-only origin master
git rev-parse --short HEAD