Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Sync upstream main

on:
schedule:
# Run daily at 6 AM UTC
- cron: '0 6 * * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout signet-main
uses: actions/checkout@v4
with:
ref: signet-main
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 remote
run: git remote add upstream https://github.com/blockscout/frontend.git

- name: Fetch upstream
run: git fetch upstream main

- name: Update main branch
run: |
git checkout main || git checkout -b main upstream/main
git reset --hard upstream/main
git push origin main --force

- name: Try to merge upstream into signet-main
id: merge
run: |
git checkout signet-main
if git merge upstream/main --no-edit; then
echo "merge_status=success" >> $GITHUB_OUTPUT
git push origin signet-main
else
echo "merge_status=conflict" >> $GITHUB_OUTPUT
git merge --abort
fi

- name: Create PR if conflict
if: steps.merge.outputs.merge_status == 'conflict'
run: |
BRANCH="upstream-sync-$(date +%Y%m%d)"
git checkout -b $BRANCH upstream/main
gh pr create \
--title "chore: sync upstream main (conflicts need resolution)" \
--body "Automated upstream sync. There were merge conflicts that need manual resolution.

This PR contains the latest changes from upstream blockscout/frontend main branch.

Please resolve conflicts and merge into signet-main." \
--base signet-main \
--head $BRANCH
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading