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.
This commit is contained in:
Digikwal 2025-06-26 16:39:10 +02:00 committed by GitHub
parent 8b88d0e06e
commit 867716dc33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"