frappe_docker/.github/workflows/auto-merge-fieldmate.yml
Digikwal 867716dc33
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.
2025-06-26 16:39:10 +02:00

42 lines
1,005 B
YAML

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"