Skip to content

Sync Upstream

Sync Upstream #17

Workflow file for this run

name: Sync Upstream
on:
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Add upstream and fetch
run: |
git remote add upstream https://github.com/ultraworkers/claw-code.git
git fetch upstream main
- name: Check for new commits
id: check
run: |
BEHIND=$(git rev-list --count dev..upstream/main)
echo "behind=$BEHIND" >> $GITHUB_OUTPUT
echo "$BEHIND new commits from upstream"
- name: Merge upstream into dev
if: steps.check.outputs.behind != '0'
run: |
# Try clean merge first
if git merge upstream/main --no-edit; then
echo "Clean merge — no conflicts"
else
echo "Conflicts found — resolving with ours strategy (keeping our changes)"
git merge --abort
git merge upstream/main --no-edit -X ours
fi
- name: Push to dev
if: steps.check.outputs.behind != '0'
run: |
git push origin dev