Ying-Shan Lin
Ying-Shan Lin

Reputation: 894

Unable to trigger GitHub Actions when pull request comes from a forked repository

There is a private repository with a GitHub Actions workflow. When I create a pull request between branches in this repository, the GitHub Actions workflow is triggered correctly.

name: CI

on:
  pull_request:
    branches:
      - pre-production
      - production

jobs:
  build:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 2
...

However, when another developer who only has read permission forks this repository, makes some commits, and then creates a pull request to the Upstream, the GitHub Actions workflow is not triggered. I have confirmed that they created the pull request to the correct branch.

Is there a setting that allows other developers with read permission to trigger the GitHub Actions workflow in the Upstream?


Updated:

There is an option in the repository settings called "Run workflows from fork pull requests", but I cannot enable it.

Upvotes: 15

Views: 7915

Answers (1)

Ying-Shan Lin
Ying-Shan Lin

Reputation: 894

Finally, I found a setting called "Run workflows from fork pull requests". Enable it will solve the problem.

If the repository is under an organization, we should enable it in the organization settings. After that, we can enable it in the repository settings.

Upvotes: 20

Related Questions