Search code examples
githubgithub-actionspull-request

How can a GitHub owner run and external PR through GitHub Actions?


I got a PR at https://github.com/UnlyEd/github-action-store-variable/pull/58 as an external PR, hence, GitHub Actions are "restricted" for security reasons.

How can I, the owner of the destination repository, make it so that PR goes through the proper GitHub Actions without the usual restrictions?

I know I could fork the branch and make a new (internal) PR, but that takes time, is there a simpler/faster solution?


Solution

  • Workflows, generally, by default, won't run on PRs submitted from forks from external contributors.

    To allow workflows to run on such PRs, it's required to manually approve the workflow runs.

    1. Under your repository name, click Pull requests.
    2. In the list of pull requests, click the pull request you'd like to review.
    3. On the pull request, click Files changed.
    4. Inspect the proposed changes in the pull request and ensure that you are comfortable running your workflows on the pull request branch. You should be especially alert to any proposed changes in the .github/workflows/ directory that affect workflow files.
    5. If you are comfortable with running workflows on the pull request branch, return to the Conversation tab, and under "Workflow(s) awaiting approval", click Approve and run.

    It is also possible to configure how strict or often the manual approval is required, with the three different categories being "all workflows from all external contributors all the time", "all workflows from all external contributors the first time they are contributing here", and "all workflows from all external contributors the first time they are contributing here who are new to GitHub."

    1. On GitHub.com, navigate to the main page of the repository.
    2. Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.
    3. In the left sidebar, click Actions, then click General.
    4. Under Fork pull request workflows from outside collaborators, choose one of the options.
    5. Click Save to apply the settings.