diff --git a/.github/workflows/rebase-check.yml b/.github/workflows/rebase-check.yml deleted file mode 100644 index 56182f1322..0000000000 --- a/.github/workflows/rebase-check.yml +++ /dev/null @@ -1,71 +0,0 @@ - -name: Rebase Check - -on: - pull_request: - branches: - - staging - - draft - -jobs: - rebase-check: - runs-on: ubuntu-latest - steps: - - name: Checkout feature branch - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - fetch-depth: 0 - - - name: Set up Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Set up PAT authentication - env: - PAT: ${{ secrets.Rebase_PAT }} - run: | - git remote set-url origin https://${PAT}@github.com/${{ github.repository }}.git - - - name: Fetch target branch - run: git fetch origin ${{ github.base_ref }} - - - name: Check if feature branch is behind base branch - id: behind_check - run: | - COMMITS_BEHIND=$(git rev-list --count HEAD..origin/${{ github.base_ref }}) - echo "Commits behind: $COMMITS_BEHIND" - if [ "$COMMITS_BEHIND" -gt 0 ]; then - echo "needs_rebase=true" >> "$GITHUB_OUTPUT" - else - echo "needs_rebase=false" >> "$GITHUB_OUTPUT" - fi - - name: Comment if rebase is not required - if: steps.behind_check.outputs.needs_rebase == 'false' - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - body: 'Rebase not required. You are good to merge the branch.' - }) - - - name: Exit workflow if rebase is not required - if: steps.behind_check.outputs.needs_rebase == 'false' - run: exit 0 - - - name: Attempt rebase onto target branch - run: | - git rebase origin/${{ github.base_ref }} - - name: Check for rebase conflicts - run: | - if [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then - echo "Rebase conflicts detected. Please rebase manually." - exit 1 - fi - - name: Push rebased branch (optional) - if: success() - run: git push --force-with-lease origin HEAD:${{ github.head_ref }}