-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default to accepting either master or main as the devbranch #1727
Conversation
src/deployconfig.jl
Outdated
struct CommonDevBranches end | ||
|
||
matches_devbranch(branchname, devbranch) = branchname == devbranch | ||
matches_devbranch(branchname, ::CommonDevBranches) = branchname ∈ ("main", "master", "dev") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matches_devbranch(branchname, ::CommonDevBranches) = branchname ∈ ("main", "master", "dev") | |
matches_devbranch(branchname, ::CommonDevBranches) = branchname ∈ ("main", "master") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before I was considering also allowing dev
.
But the only repo i know that uses dev
is MLJ, and they do not see the devbranch=dev
argument.
And so accepting that would potentially break their workflow.
https://github.com/alan-turing-institute/MLJ.jl/blob/96562a60a70aebc3f0d768147ff9dab4549ddfa5/docs/make.jl#L98-L101
@warn """ | ||
Possible deploydocs() misconfiguration: main vs master | ||
Documenter's configured primary development branch (`devbranch`) is "master", but the | ||
current branch (\$TRAVIS_BRANCH) is "main". This can happen because Documenter uses | ||
GitHub's old default primary branch name as the default value for `devbranch`. | ||
current branch (\$TRAVIS_BRANCH) is "main". | ||
|
||
If your primary development branch is 'main', you must explicitly pass `devbranch = "main"` | ||
to deploydocs. | ||
Or remove the `devbranch` setting to fallback to the default which accepts both. | ||
|
||
See #1443 for more discussion: https://github.com/JuliaDocs/Documenter.jl/issues/1443 | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can just delete this whole condition and warning message?
(and the other several copies of it for the other CI providers)
It seems like people are not going to do it by mistake anymore, with the new default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump |
Poking people from original issue |
Alternatively, could we query git for the name of the default branch? I.e. something like this: https://davidwalsh.name/get-default-branch-name. I think this is probably fine as a solution to #1443, but I am wondering if we can avoid hard coding a set of common default branch names. |
We could, but a problem is a surprising number of CI environments don't have |
I wouldn't really say I had strong opinions... I just wanted old code to keep working (and preferred a design where there is no need to "chase" the default branch which apparently cannot be relied on to stay fixed). I haven't looked at the code here but if it works as described it should reduce the level of urgency and can be improved at a later point by querying the default branch.
Doesn't Documenter push the docs via |
Good point. Looks like it does. The stuff in https://davidwalsh.name/get-default-branch-name looks kinda fragile. |
maybe? |
It's a bit harder than that according to https://davidwalsh.name/get-default-branch-name#comment-515994 Apparently if we translate |
Closes #1443
Basically this introduces a magic default value for
devbranch
which will match to eithermaster
ormain
.This allows people to rename their default branch in git, without having to also having to add in the
devbranch
argument in thedocs/make.jl
.Which is good if you have many repos to switch over.
This implementation doesn't depend on e.g. reading the git settings to find out the default branch, or probing git to see what branches exist.
It just naively accepts either name.
Which makes for easy implementation.
Technically this is breaking, if someone was using
main
as the name of some other branch unrelated to it being the devbranch, and didn't havedevbranch="master"
(or similar) set then suddenly docs would start deploying every time they pushed to that unrelatedmain
branch.I don't know if this is a realistic concern.
There are 3 responses to that:
docs/Project.toml
master
or hard-codedevbranch="main"