Add automated upstream sync workflow

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-24 18:22:44 -04:00
co-authored by Claude Fable 5
parent 9ce9f300ae
commit 2fd24589c2
+46
View File
@@ -0,0 +1,46 @@
name: upstream-sync
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: quattro
fetch-depth: 0
- name: Fetch upstream and open sync PR
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.server_url }}/api/v1
REPO: ${{ github.repository }}
run: |
set -euo pipefail
git config user.name "omarchycn-sync"
git config user.email "sync@noreply.git.zacharyzhang.com"
git remote add upstream https://github.com/basecamp/omarchy.git
git fetch upstream quattro
UP=$(git rev-parse upstream/quattro)
echo "upstream quattro: $UP"
if git merge-base --is-ancestor "$UP" HEAD; then
echo "Already up to date with upstream"
exit 0
fi
BR="sync/upstream-${UP:0:8}"
if git ls-remote --exit-code --heads origin "$BR" > /dev/null; then
echo "Sync branch $BR already exists, PR pending review"
exit 0
fi
git checkout -b "$BR"
# Merge conflicts fail the job loudly; resolution is manual by design
git merge --no-edit "upstream/quattro"
git push origin "$BR"
curl -sS --fail-with-body -X POST \
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
"$API/repos/$REPO/pulls" \
-d "{\"base\":\"quattro\",\"head\":\"$BR\",\"title\":\"Sync upstream omarchy ${UP:0:8}\",\"body\":\"Automated sync of basecamp/omarchy quattro @ $UP. Review changes, run ./test/all, then merge.\"}"