Auto Merge on Approval #298
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |