From 867716dc333b3bd8b01d8794250a37315c8cf4f8 Mon Sep 17 00:00:00 2001 From: Digikwal <79085106+digikwal@users.noreply.github.com> Date: Thu, 26 Jun 2025 16:39:10 +0200 Subject: [PATCH] ci: Auto-merge PRs from fieldmate releases This commit introduces a GitHub Actions workflow that automatically merges pull requests created by the fieldmate release process. What it does: - Detects PRs from branches starting with `fieldmate-auto-release` - Attempts to enable auto-merge via GitHub CLI - Falls back to direct squash merge if auto-merge is not possible - Uses consistent commit messages and descriptions This ensures that updates to fieldmate in frappe_docker are propagated cleanly and automatically, triggering rebuilds where needed. --- .github/workflows/auto-merge-fieldmate.yml | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/auto-merge-fieldmate.yml diff --git a/.github/workflows/auto-merge-fieldmate.yml b/.github/workflows/auto-merge-fieldmate.yml new file mode 100644 index 00000000..0c294a25 --- /dev/null +++ b/.github/workflows/auto-merge-fieldmate.yml @@ -0,0 +1,42 @@ +name: Auto-merge PRs from fieldmate + +on: + pull_request: + branches: + - main + types: + - opened + - synchronize + - reopened + +permissions: + contents: write + pull-requests: write + +jobs: + automerge: + if: startsWith(github.head_ref, 'fieldmate-auto-release') + runs-on: ubuntu-latest + + steps: + - name: Enable auto-merge or fallback merge + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + echo "Trying to enable auto-merge for PR #$PR_NUMBER" + + # Try auto-merge first + gh pr merge "$PR_NUMBER" \ + --squash \ + --auto \ + --delete-branch \ + --body "$COMMIT_BODY" \ + --subject "$COMMIT_TITLE" || \ + + # Fallback: direct squash merge + gh pr merge "$PR_NUMBER" \ + --squash \ + --delete-branch \ + --body "$COMMIT_BODY" \ + --subject "$COMMIT_TITLE"