Closed banesullivan closed 2 years ago
Git's default branch is still master
, so any repo created with git init
will still use that. Since we can't assume that a repo has a particular default branch name, I don't think this is going to help.
However, I found this suggestion: https://stackoverflow.com/a/68414395 . I think that might solve things generally.
@banesullivan If that sounds like it'll work, could you update this PR with that change? We can actually dogfood it by changing https://github.com/girder/cookiecutter-girder-4/blob/master/.github/workflows/ci.yml#L6 too.
That doesn't seem to work: https://github.com/girder/cookiecutter-girder-4/actions/runs/1742947993
I'll change this to let the user specify the default branch in the cookie-cutter options
edit: it would work by putting an if:
on the job itself but that would be really messy and prevent triggers from pull_request
, workflow_dispatch
, etc. without a verbose logical expression
Updated to have a new default_branch
option, which IMO should default to main
It seems that GitHub Actions currently lacks technical support for dynamic matching of the default branch. It must be named.
This cookiecutter (like any) requires the bootstrapping developer to run git init
as a separate step, and they can easily select any default branch name. Deciding which specific name is best is beyond what this cookiecutter can address. Downstream projects can make their own choices, and it's easy to alter the default branch at project bootstrap.
I'll file a bug to revisit this if GitHub adds support for dynamic branch names
See https://github.com/girder/cookiecutter-girder-4/issues/188
To be clear, I'm sympathetic to projects that want to use a different Git repo structure. However, I don't want to add even more complexity to this repo by having a new cookiecutter option, unless it adds greater utility.
The default base branch for GitHub is now
main
and the cookiecutter's workflow should reflect that.