From 2fd24589c2013cc660e025d716e73eb1fe3c938e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Mon, 24 Aug 2026 18:22:44 -0400 Subject: [PATCH] Add automated upstream sync workflow Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp --- .gitea/workflows/upstream-sync.yml | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .gitea/workflows/upstream-sync.yml diff --git a/.gitea/workflows/upstream-sync.yml b/.gitea/workflows/upstream-sync.yml new file mode 100644 index 00000000..db4d8c09 --- /dev/null +++ b/.gitea/workflows/upstream-sync.yml @@ -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.\"}"