-
Notifications
You must be signed in to change notification settings - Fork 7
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
A PR diff may show docs changes if the source branch is not based on the latest target commit #3
Comments
I've tried reading up on this, because I thought the checkout action already does some rebasing/merging. According to the documentation of the |
For reference, here is one PRs where this happened: |
The problem might be that we're explicitly requesting the checkout of the HEAD's commit by specifying |
Hmm, testing seems to be more tricky. I've created a PR which is based of an older version of |
#14 fixes this. It's not a perfect fix (see the comment it adds), but I'm not sure how to improve it... |
For example, if a PR is created from a branch that based on
main
, and a new commit tomain
after branching changes docs, then the PR docs build will show that the PR changes the docs, even though that is not the case. In fact, the docs inmain
are ahead of what's in the PR, and ideally the PR's branch would be rebased, however it is not always necessary to rebase a branch when there are otherwise no conflicts.The reason this happens is that in the PR workflow, we build the docs for both the BASE and HEAD commit of the PR. If the PR is against
main
for example, we build docs formain
, but since the PR is based on an earliermain
commit, the output will be different.One thing we can try to do, is do our BASE build against the commit that the PR branch was started from. That would solve the situation laid out above.
But in another case, consider that the PR actually did change docs, but
main
is now ahead of the branch with its on changes. If we build against the PR branch's original base, we will showing the (intended) changes of the PR, but will not necessarily be representing the sate of the docs after the PR is merged.Although GitHub will alert to conflicts in the tracked files, the rendered docsite is not tracked.
I'm not sure what the best or correct course of action is.
I don't think it's a good idea to do 3 builds, comparing the PR to both its own base and to its merge target, it seems a little too complicated.
A third option, whether the base render is based on latest target or on branch's base, is to detect that the branch has drifted, and include a warning in the PR comment that the differences shown may not be accurate, recommending a rebase if accuracy is a concern.
The text was updated successfully, but these errors were encountered: