Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 2
Message 1 of 2

Event pull_request_review restrict PR base branch

For event pull_request_review is it possible to trigger workflow only when the review is submitted on a PR whose base branch is master.

This workflow shouldn't get triggered on reviews on any other branch other than master.

1 Reply
GitHub Staff
Message 2 of 2

Re: Event pull_request_review restrict PR base branch

 

@nikhilaii93 - It's possible to limit the types of activity that will trigger a workflow run using the `types` field:

 

https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-g...

 

Here's an example workflow that triggers on the `pull_request_review` event only when a review is `submitted`:

 

on:
  pull_request_review:
    types: [submitted]

 

In the job, you can use the `if` conditional at the `job` level and the `github` context to run said job only if the base ref is `master`:

 

https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-g...

https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expressi...

 

Here's an example:

 

jobs:
  job1:
    if: github.base_ref == 'master'

 

Hope this helps!