GuangchuangYu/badger

`Error: Default branch mismatch between local repo and remote.` persists

Closed this issue · 2 comments

Hello,

I use badger extensively in all my packages now and they look awesome (and informative)! We're trying to include badges in the README of our package MungeSumstats.

Unfortunately, as of a couple weeks ago i noticed on GH Actions that when I try to knit .Rmd files, badger gives this error:
https://github.com/neurogenomics/MungeSumstats/runs/4508279435?check_suite_focus=true

Screenshot 2021-12-13 at 16 07 57

In other packages where I encountered this message, I ran the recommended solution and it worked like a charm:

usethis:: git_default_branch_rediscover()

However, I've run this several times with MungeSumstats on my local machine, and now when I run this it just says:

Screenshot 2021-12-13 at 16 13 35

Yet the same issue persists when i push to GH.

I should note that I'm pushing to our "bschilder_dev" branch, but the default branch is indeed "master".

Do you have an idea of what might be going on here?

Many thanks in advance,
Brian

Tagging the codevs @Al-Murphy @NathanSkene

That's certainly strange. My best guess is that GitHub Actions sets up the repos in such a way that the current repo is detected as the default within GHA, even though the correct default repo is master.

badge_last_commit() and badge_codecov() try to determine the default branch automatically. You could solve this by adding a branch argument in your README.Rmd manually:

`r badger::badge_last_commit(branch = "master")`
`r badger::badge_codecov(branch = "master")`

I agree it would be nice if the default branch was more easily detected within GitHub Actions, but I'm not sure if that's something that can be solved in badger, or if it would be better as an issue in usethis.

Hi @GuangchuangYu , thanks so much for the fast response. Setting branch="master" in both worked perfectly.

Based on your guess and the usethis documentation I can see how the issue might arise. Good to know!