gh-action-bump-version icon indicating copy to clipboard operation
gh-action-bump-version copied to clipboard

Issues with branch being up to date in a monorepo

Open thekevinscott opened this issue 9 months ago • 5 comments

I have a monorepo with two packages, foo and bar. I have a pnpm-lock file at the root.

Changes to one or the other package work beautifully; however, I've set up changes to pnpm-lock to trigger a version for both packages. This fails because the branch is out of date:

runInWorkspace | command: git args: [
  'push',
  '***github.com/thekevinscott/MyRepo.git',
  '--follow-tags'
]
✖  fatal     To https://github.com/thekevinscott/MyRepo.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/thekevinscott/MyRepo.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

git exited with code 1
✖  fatal     Failed to bump version

I'm not sure the right way around this. Ideally I would do a pull, rebase, and then push. But I don't see support for that in the code.

I suppose my question is two-fold:

  1. Is there a recommended approach for working with monorepos that may version multiple packages at the same time?
  2. If not, would you accept a PR that modifies the script to first do a git pull if an option is specified?

thekevinscott avatar May 09 '24 13:05 thekevinscott