-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Detect when the default branch is renamed (e.g. from master
to main
)
#7907
Comments
@reaperhulk can you describe what steps you followed? If you import your project by using our wizard ("Import a Project" button), If you has a project already imported and you rename |
The latter (rename) is what occurred. If RTD can’t detect arbitrary branch rename (although has anyone reported an issue to GH about that?) then in a case where master disappears it seems worthwhile to probe for main and use that if present. It’s possible this will be wrong but it will be right far more often. |
Here we aren't assuming the name of the branch, it's the name already given to the latest version, it is hard to us to assume the branch was re-named and not deleted, we are stopping from "doing magic" in favor of users to be explicit. So, I don't think we would implement some custom logic for this case. You can use the API to automate this https://docs.readthedocs.io/en/stable/api/v3.html#project-update ("default_branch"). |
I have a question related to this. In my case, I actually renamed |
I too have a question relating to this. My packages main branch is |
@pllim @this-josh when the option is empty ( |
@stsewd. My project: https://github.com/this-josh/felling as you can see there isn't a "master" branch, and in RTD the only option is |
@this-josh can you link me to your Read the Docs project? (not the repo) |
@stsewd Sorry, here it is: https://felling.readthedocs.io/en/latest/ . Note it built when I first made the project as it correctly identified the |
Is there a reason why the RTD default cannot be consistent with |
The value is harcoded. We could make it dynamic, but not all repos are connected to a remote repository. |
@this-josh looks like your project was building with main at the beginning, but them for some reason all versions disappeared. That's why you only see https://readthedocs.org/projects/felling/builds/13325683/ Let us know if you see this happening again. Edit: looks like your project isn't creating the versions, this may be a bug, I'm looking into that. |
@this-josh I found the problem, you have two versions with the same name: |
When using bulk_create, the post_save signal isn't called. The VersionSlugField relies on that https://github.com/readthedocs/readthedocs.org/blob/27b1f020a34a4fadaf93e2a1880e6b07b0aa3771/readthedocs/builds/models.py#L141-L145 Ref #7907 (comment)
@stsewd Thanks for manually setting it to main. No, I haven't used the single version option as ideally I'd like multiple versions eventually. Thank you for finding that! This is the first time I've tried to properly version a package and I've certainly had a few hiccups along the way. I have removed the tag |
When using bulk_create, the post_save signal isn't called. The VersionSlugField relies on that https://github.com/readthedocs/readthedocs.org/blob/27b1f020a34a4fadaf93e2a1880e6b07b0aa3771/readthedocs/builds/models.py#L141-L145 Ref #7907 (comment)
FYI: This affected at least 2 of PyPA's projects as well, and it is a very subtle breakage that isn't detected until someone notices things being missing in the changelog or something. The fix is relatively straightforward, once you know what's happening though. I've described what I had to do for pypa/packaging in pypa/packaging#415 (comment). |
master
to main
)
Hi all - we acknowledge this is affecting lots of projects these days, and that RTD is not very smart about it. We have some internal changes underway that could simplify this transition or make it invisible for users, but it will still take us some time to get there. In the meanwhile, if you rename your default branch from
From here, everything should work again. Please notice that:
I am renaming this issue to clarify what's actually happening, and pinning it so it's more visible. We will update here if we improve the detection of branch renames for projects linked to GitHub repositories. Sorry all for the inconvenience and thanks for your patience! |
master
to main
)master
to main
)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Currently, we are using `Project.default_branch` when it's defined and falling back to VCS's default branch. However, with the massive rename from `master` to `main` in GitHub, a lot of project are pointing to the wrong default branch. Since we are storing the default branch of the GitHub repository under `RemoteRepository.default_branch` and we are refreshing this list more frequently now, we can use it before using VCS's default branch as fallback. Closes #7907
I'm experiencing a similar issue now but after checking the option to build pull requests, the default branch is set to |
Same Issue. Just moved from
@astrojuanlu this doesn't work. RTD doesn't display the Is it possible to change it some other way? Here's the project: https://readthedocs.org/api/v3/projects/aura-automated-radio/ |
I was able to update the default branch through API:
curl \
-X PATCH \
-H "Authorization: Token $TOKEN" https://readthedocs.org/api/v3/projects/$PROJECT/ \
-H "Content-Type: application/json" \
-d '{ "default_branch": "main" }' Note, to replace your $TOKEN and $PROJECT. But then, when checking for the default branch in the UI:
...this is now updated from "master" to "--------". When clicking the dropdown, there is still no "main" branch available. But when triggering a manual build, now it is cloning from the |
Currently, we are using `Project.default_branch` when it's defined and falling back to VCS's default branch. However, with the massive rename from `master` to `main` in GitHub, a lot of project are pointing to the wrong default branch. Since we are storing the default branch of the GitHub repository under `RemoteRepository.default_branch` and we are refreshing this list more frequently now, we can use it before using VCS's default branch as fallback. Closes #7907
Currently, we are using `Project.default_branch` when it's defined and falling back to VCS's default branch. However, with the massive rename from `master` to `main` in GitHub, a lot of project are pointing to the wrong default branch. Since we are storing the default branch of the GitHub repository under `RemoteRepository.default_branch` and we are refreshing this list more frequently now, we can use it before using VCS's default branch as fallback. Closes #7907
Currently, we are using `Project.default_branch` when it's defined and falling back to VCS's default branch. However, with the massive rename from `master` to `main` in GitHub, a lot of project are pointing to the wrong default branch. Since we are storing the default branch of the GitHub repository under `RemoteRepository.default_branch` and we are refreshing this list more frequently now, we can use it before using VCS's default branch as fallback. Closes #7907
Once #8988 got merged and released, Read the Docs will autodetect the default branch defined by the VCS repository connected if the project was imported using the "Import Project" wizard (if it was manually imported it may not be connected to the VCS repository). However, it may require forcing a re-sync of the VCS data first:
After that, if you have changed the default branch Read the Docs should use the new default branch set at your repository. |
I have the same problem as described above. My github repo never had a master branch and I am getting only an empty (------) option in the Default branch of the advanced settings. |
@georgedimitriadis make sure that you have granted access to the Read the Docs OAuth App for your GitHub organization |
Thanks for the reply. That was the solution to my problem. |
I'm having an issue with this while using RTD with the chemprop package. Chemprop has been on RTD for several years and has previously always had We recently released a new version of chemprop that we had been developing on our The error we're seeing is
I created a new RTD version that points directly to We're also tracking this in our own issue: chemprop/chemprop#828 EDIT: this was resolved in #11321 |
Details
RTD, by default, attempts to guess what the default branch is based on the VCS you have configured. For
git
it defaults to assuming the namemaster
. With GitHub migrating tomain
(see: https://github.com/github/renaming) this results in a build failure until the user notices and manually sets the branch tomain
in the advanced settings.Expected Result
RTD should keep building after the default branch name is changed to
main
.Actual Result
It fails and users need to manually set it in the advanced settings.
The text was updated successfully, but these errors were encountered: