CircleCI-Archived / build-tools-orb

An orb with handy tools for use in CircleCI jobs
https://circleci.com/developer/orbs/orb/circleci/build-tools
MIT License
8 stars 9 forks source link

Command "merge-with-parent" should merge with destination branch on PR when available #27

Open dsayling opened 3 years ago

dsayling commented 3 years ago

https://circleci.com/developer/orbs/orb/circleci/build-tools#commands-merge-with-parent

Currently, the command only supports merging with the parent branch (based on the history of the current branch) or a branch specified by the existing parameter. However, this is not ideal when a PR is trying to merge to an indirect parent branch.

This could be implemented by adding an additional parameter, like apply_pr_dest that will attempt to find the destination branch in the PR via the GitHub API and then do the appropriate pull/merge. In the event the flag is set and no destination branch is available (e.g. there's not a PR implying the destination branch) we could use the existing mechanism to find the parent branch.

gmemstr commented 3 years ago

This might prove a little limiting/brittle using the GitHub API (what if the project is from Bitbucket?). While I agree this is something we should look into building, I'm not sure what the best approach would be short of building in queries for both provider APIs.