Pull requests testing

In Buddy, you can test and deploy pull requests using pipelines. Every time a pull request is created and/or a push is made to the corresponding branch, Buddy will automatically run the defined pipeline and send its result to GitHub.

Forks and Branches

You can create pull requests within the same repository or a fork repository. If you run all pull requests within one repository and you don't work on a fork model, then it's enough to create a pipeline with * wildcard to test your pull requests. The pipeline will be run after every push to any branch in your repository. Thanks to that, each commit will be tested straight away and when you open a pull request, it will be marked with a status depending on the tests' result.

For security reasons, forked pull requests support is switched off by default. To activate it, go to the 'Pipelines' tab and click 'Pull Requests' in the right menu: Forked pull requests

Once you switch this option on, you'll be able to select 'Pull requests by wildcard' as the ref in the pipeline settings: Adding a new pipeline

If you have PR support switched on, make sure to use the refs/pull/* wildcard instead of a single *, as the second one will run the pipeline twice for pull requests within the same repository. This is because the pipeline will run both for the push and the pull request in the same branch.

Actions

Now we can add a testing action and a notification that will let us know in case something goes wrong: Pipeline example

To learn more about configuring tests in Buddy, check out this article.

Security

Please mind that if your repo is public then everybody is allowed to fork it and create pull requests. This means that you should take special precautions towards securing the data defined in the environment variables—in forked repositories anybody can write a script that will expose your variables, and execute it remotely with a pipeline.

See also