Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github actions 'pull_request_review' on a specific target branch

We are trying to setup a github action which only triggers on pull_request_review for pull requests targeted to a specific base branch pattern release/*

This is so we have a GH action be able to check if the review is from a specific release gatekeeper group.

Doing something like so, does not seem to work only for PR's targeted to release/* branches. It seems to trigger on PR reviews target to all base branches

on:
  pull_request_review:
    branches:
      - release/*

Seems to us that we cannot chain the base branch like so

like image 470
Kevin Vella Avatar asked Sep 07 '25 16:09

Kevin Vella


1 Answers

You can make it work by setting condition as in:

on:
pull_request_review:
    branches:
        - release/**

jobs:
  release-job:
    if: startsWith(github.event.pull_request.base.ref, 'release/')

This basically checks base reference for text (not case sensitive).

If the condition is false the wf will be still displayed among other ones, but will be shown as skipped (0s execution time).

Note that you would need to set this if condition for every job in a workflow.

I don't think you need branch filter anymore.

like image 135
d.stack Avatar answered Sep 11 '25 00:09

d.stack