Pipeline.git.base-revision defaults to main on new branches

We’re trying to utilize the path-filtering orb to only run database migrations on our release/deploy branches when we have a new one to run, and are having two problems.

The first problem we’ve noticed is if we’re using pipeline.git.branch as the base-revision, it is only comparing the latest commit to the branch, and thus will only run migrations if there’s a change in the latest commit we’re merging to a release branch. This is a monorepo and thus we’ve got a ton of devs merging, so the likelihood that the latest commit merged to a release branch actually has a migration is pretty low, and thus we’d never run migrations even when we need to.

To work around that, we’ve set base-revision to pipeline.git.base_revision. This works for branches that have already existed, but for new branches (i.e. a PR gets created), the base-revision always defaults to main, instead of the actual default branch (which we’ve still got set to master on this repo).

Basically, I’m looking for a solution that either allows us to compare all of the commits in a push to the base, or a way to have base-revision set to our actual default branch name if it’s a new branch. Any help or advice is greatly appreciated!

1 Like

You may find it helps to post the issues on the github area that hosts the orb as the current developer/maintainer is more likely to be monitoring for posts there.

Here you are more dependent on other end users who have used the orb and found the same limitation to reply.

I posted it here for 2 reasons:

  1. The orb is maintained by CircleCI.
  2. << pipeline.git.base-revision >> is set by CircleCI itself, not the orb.

Have you managed to resolve this?