Skip to content

Check if PR is approved #212

Check if PR is approved

Check if PR is approved #212

name: Check if PR is approved
on:
pull_request_review:
types: [submitted]
jobs:
merge-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 'Prevent merging into development if the PR is not approved'
if: github.event.review.state != 'approved'
uses: actions/github-script@v3
with:
script: |
core.setFailed('The PR is not approved to be merged into development')
- name: 'Is the PR is approved?'
if: github.event.review.state == 'approved'
run: |
mkdir -p ./pr
echo ${{ github.event.pull_request.number }} > ./pr/NR
- name: 'Store the PR number if approved'
if: github.event.review.state == 'approved'
uses: actions/upload-artifact@v2
with:
name: pr
path: pr/