branch filter pattern based on repository_owner

Hi GitHub Team,

I would like to trigger GitHub Actions for:

  • only specific integration branches on main repository and maintainer’s repository, let’s say master , develop , and testing
  • all branches except those whose name ends with -wip for all forks

Is it possible? I’ve something similar to tried this:

  true: [master, develop, testing]
  false: [' **', '!** -wip']

    branches: ${{ filter.${{ github.repository_owner == 'my-main' || github.repository_owner == 'maintainer-id' }} }}
      - '**'
      - '! **wip**'

Hi @sgn , 

The syntax you provided is not supported . And the idea of getting repository_owner is not working. 

There is a GITHUB_REPOSITORY in workflow default environment variables, it always shows the main repository not the forked repo. 

When a pull_request from a forked repo changed, there will be an event happened in the upstream repo (main repo) which could trigger a workflow in main repository.  

It is not that forks themselves can run arbitrary workflows,  it is that PRs raised from forks into the upstream will get run . 

There is a previous ticket with similar question:

1 Like


We decided to have a workaround and check on