Skip to content

Sync Upstream

Sync Upstream #14

Workflow file for this run

name: Sync Upstream
on:
schedule:
- cron: '0 9 * * *' # Daily at 9am UTC
workflow_dispatch:
jobs:
check-and-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Check for new upstream release
id: check
run: |
LATEST=$(curl -s https://api.github.com/repos/orbcorp/orb-python/releases/latest | jq -r .tag_name)
CURRENT=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
echo "Latest upstream: $LATEST"
echo "Current: $CURRENT"
if [ "$LATEST" != "$CURRENT" ]; then
echo "new_release=true" >> $GITHUB_OUTPUT
echo "version=$LATEST" >> $GITHUB_OUTPUT
else
echo "new_release=false" >> $GITHUB_OUTPUT
fi
- name: Sync upstream changes
if: steps.check.outputs.new_release == 'true'
run: |
git remote add upstream https://github.com/orbcorp/orb-python.git || true
git fetch upstream --tags
# Create branch for the sync
git checkout -b sync-upstream-${{ steps.check.outputs.version }}
# Merge upstream tag
git merge ${{ steps.check.outputs.version }} -m "Merge upstream ${{ steps.check.outputs.version }}" || true
- name: Re-apply customizations
if: steps.check.outputs.new_release == 'true'
run: |
chmod +x ./scripts/apply-customizations.sh
./scripts/apply-customizations.sh
- name: Set up Python
if: steps.check.outputs.new_release == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install and test
if: steps.check.outputs.new_release == 'true'
run: |
pip install uv
uv pip install -e ".[dev]" --system
pytest tests/ -x -q
- name: Commit customizations
if: steps.check.outputs.new_release == 'true'
run: |
git add -A
git commit -m "Apply orb_sdk customizations" || true
- name: Push and create PR
if: steps.check.outputs.new_release == 'true'
run: |
git push -u origin sync-upstream-${{ steps.check.outputs.version }}
gh pr create \
--title "Sync upstream ${{ steps.check.outputs.version }}" \
--body "Automated sync from orbcorp/orb-python ${{ steps.check.outputs.version }}" \
--base main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge
if: steps.check.outputs.new_release == 'true'
run: |
gh pr merge --auto --squash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}