Skip to content

Auto Merge on Approval #298

Auto Merge on Approval

Auto Merge on Approval #298

Workflow file for this run

name: Auto Merge on Approval
on:
pull_request_review:
types:
- submitted
jobs:
auto_merge:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if approved
id: check_approval
run: |
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "::set-output name=approved::true"
else
echo "::set-output name=approved::false"
fi
shell: bash
- name: Setup GitHub CLI
if: steps.check_approval.outputs.approved == 'true'
run: |
gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}"
shell: bash
- name: Squash merge if approved
if: steps.check_approval.outputs.approved == 'true'
run: |
gh pr merge ${{ github.event.pull_request.number }} --squash --auto
shell: bash