From 6d6e13c5d298669972b45c631a4b85bfc6cc5c3d Mon Sep 17 00:00:00 2001 From: Egor Suldin Date: Sun, 10 May 2026 16:37:41 +0300 Subject: [PATCH] Improve dependabot-auto-approve workflow The merge command may fail, if the PR is not on the top of main branch. Therefore, try to rebase PR if the merge failed. --- .github/workflows/dependabot-auto-approve.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/dependabot-auto-approve.yml b/.github/workflows/dependabot-auto-approve.yml index 693ad32..5fb1156 100644 --- a/.github/workflows/dependabot-auto-approve.yml +++ b/.github/workflows/dependabot-auto-approve.yml @@ -20,12 +20,22 @@ jobs: env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Merge a PR + id: gh-merge run: gh pr merge "${{github.event.pull_request.html_url}}" --delete-branch --squash env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + continue-on-error: true - name: Run CI workflow + if: steps.gh-merge.outcome == 'success' run: | gh workflow run ci.yml --ref "${{github.event.pull_request.base.ref}}" \ --repo "${{github.event.pull_request.base.repo.html_url}}" env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Rebase PR + if: steps.gh-merge.outcome == 'failure' + run: | + gh pr update-branch "${{github.event.pull_request.number}}" --rebase \ + --repo "${{github.event.pull_request.base.repo.html_url}}" + env: + GH_TOKEN: ${{secrets.GITHUB_TOKEN}}