From 2bbe15a329e35f5156cdafcbe63c3fd54978ff98 Mon Sep 17 00:00:00 2001 From: Ray Myers Date: Fri, 10 Oct 2025 15:19:00 -0500 Subject: [PATCH] chore - CI check migrations are in sync and warn (#10946) --- .../workflows/enterprise-check-migrations.yml | 52 +++++++++++++++++++ enterprise/migrations/README.md | 5 ++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/enterprise-check-migrations.yml create mode 100644 enterprise/migrations/README.md diff --git a/.github/workflows/enterprise-check-migrations.yml b/.github/workflows/enterprise-check-migrations.yml new file mode 100644 index 0000000000..8daca0e1b1 --- /dev/null +++ b/.github/workflows/enterprise-check-migrations.yml @@ -0,0 +1,52 @@ +name: Enterprise Check Migrations + +on: + pull_request: + paths: + - 'enterprise/migrations/**' + +jobs: + check-sync: + runs-on: ubuntu-latest + steps: + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + + - name: Fetch base branch + run: git fetch origin ${{ github.event.pull_request.base.ref }} + + - name: Check if base branch is ancestor of PR + id: check_up_to_date + shell: bash + run: | + BASE="origin/${{ github.event.pull_request.base.ref }}" + HEAD="${{ github.event.pull_request.head.sha }}" + if git merge-base --is-ancestor "$BASE" "$HEAD"; then + echo "We're up to date with base $BASE" + exit 0 + else + echo "NOT up to date with base $BASE" + exit 1 + fi + + - name: Find Comment + uses: peter-evans/find-comment@v3 + id: find-comment + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: | + ⚠️ This PR contains **migrations** + + - name: Comment warning on PR + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: replace + body: | + ⚠️ This PR contains **migrations**. Please synchronize before merging to prevent conflicts. diff --git a/enterprise/migrations/README.md b/enterprise/migrations/README.md new file mode 100644 index 0000000000..218c5cff2b --- /dev/null +++ b/enterprise/migrations/README.md @@ -0,0 +1,5 @@ +# Enterprise Migrations + +## Migration conflicts + +OpenHands PRs can fall out of sync with `main` quickly. When adding a migration, it's safest to sync the PR with main before merging to ensure you are caught up to any others that have been added.