I have a github actions yaml file as follows:
name: Test deployment
on:
pull_request:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: Random name
run: date
When I raise a PR from a branch to master branch, Github Action gets triggered. So, I updated my YAML to:
name: Test deployment
on:
pull_request:
types:
- closed
branches:
- master
Now it is triggered when I merge the PR rather than while raising it. But it also gets triggered when I close the PR without merging it.
I found nothing like merged type in docs
Even the following syntax i tried does not work as expected:
jobs:
...
if: github.event_name == 'pull_request' && github.event.action == 'closed'
Can anyone pls help me out here? Is it possible for me to check if the PR is approved by atleast one reviewer? (I can enable branch protection, but wanted to know if any option exists for doing it in github actions)