You can configure Buddy to trigger executions on pull requests. This is useful when you want to check the branch for errors before merging. Currently two types of PR’s are supported:
- Single-Repo Pull Requests: the whole branching for the PR takes place within one repository
- Forked Pull Request: the pull request goes from a previously forked repository to an upstream repository (GitHub only)
Single-Repo Pull Requests
To cover pull requests for branches within the same repository, you need a single pipeline that will be executed on every push to every branch:
- Add new pipeline and set the Trigger mode to On push.
- Select Branches by wildcard as the pipeline trigger
- The default command
refs/heads/*will run all branches
Once you create the Pipeline, you can add build and test actions. The actions will be automatically triggered on every push to every branch. The results of the execution will be passed to your Git service, where they can be reviewed for readiness for merging on the corresponding PR page. Here is an example from GitHub:
Every pull request has the status of the triggered pipeline execution, like here in GitHub:
Forked Pull Requests
If you are using a forked repository to make changes that you want to merge to the upstream, you can create a pipeline that will help you decide if the changes are ready to be accepted.
By default, this feature is turned off. It can be activated by clicking Pull Requests and throwing a switch in the right column of the Pipelines tab.
Once the option is enabled, a new wildcard will become available to use in the pipeline settings: Pull requests by wildcard (
Just as with single-repo PRs, the forked PRs also have full integration with Github’s pull requests tab and the pull request activity stream for managing PRs acceptance.
If your GitHub repository is public and YAML for Buddy configuration is enabled, turning on forked pull requests in a project may lead to disclosing your sensitive data by exposing environment variables stored in your repo. In this case, it is better to switch back to the GUI mode, or not use public GitHub projects at all.