Skip to content

Automerge PR

Automerge PR #9

Workflow file for this run

name: Automerge PR
on:
pull_request_review:
types: [submitted]
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: Install gh
run: |
npm install -g gh
- name: Get approval status
id: get_approval_status
run: |
echo "::set-output name=approval_status::${{ github.context.payload.pull_request.review.state }}"
- name: Merge PR
if: ${{ steps.get_approval_status.outputs.approval_status == 'APPROVED' }}
run: gh pr merge --all
- name: Add labels
if: ${{ steps.get_approval_status.outputs.approval_status == 'APPROVED' }}
uses: actions/github-script@v5
with:
script: |
github.issues.addLabels({
issue_number: github.context.payload.pull_request.number,
labels: ['merged', 'approved']
})