sandpaper icon indicating copy to clipboard operation
sandpaper copied to clipboard

Update PR comment to present link to head commit

Open zkamvar opened this issue 4 years ago • 0 comments

In #139 (specifically in 192678211419d60a294401da1f77e53b73a8debf), we switched from the .. to the ... notation to create a link that would point users to differences between the state of the markdown outputs when they created the pull request and their changes (as opposed to the current state of the markdown outputs).

Unfortunately, this has a side-effect of not being able to show image previews of the files due to unrelated histories.

Because those branches only update when the pr-receive.yaml workflow runs, and because we always force-push that branch, we can create a commit in an orphan branch after these lines

https://github.com/carpentries/sandpaper/blob/4c6aada26c00969062f811e833ed94e548526308/R/utils-git.R#L252-L254

and record the hash of the commit to use for creating a link to the differences. We already have this process recorded in our "Create orphan and push step":

https://github.com/carpentries/sandpaper/blob/4c6aada26c00969062f811e833ed94e548526308/inst/workflows/pr-comment.yaml#L89-L104

zkamvar avatar Sep 20 '21 22:09 zkamvar