Skip to content
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

Add GitHub action to automatically render skeleton.Rmd when pull requests are made #133

Merged
merged 29 commits into from
Mar 29, 2024

Conversation

kelliemac
Copy link
Contributor

I thought it would be really helpful to have the report skeletons automatically render to pdf and docx when pull requests are made, so that PR issuers and reviewers can easily see the impact of template changes (and the current status of how reports look using the template skeleton).

This is a draft pull request - I would love to get feedback on, for example:

  1. Is there a better location in the repo to render these skeleton reports to?
  2. Are we concerned about this bloating the repo a bunch, since pdf and docx files are not tracked very efficiently by GitHub?
  3. Currently just the visc_empty skeleton.Rmd is rendered. There is also the visc_report skeleton.Rmd that we could consider rendering also/instead.

@kelliemac kelliemac self-assigned this Mar 6, 2024
@kelliemac kelliemac changed the base branch from master to develop March 6, 2024 18:13
@kelliemac kelliemac changed the base branch from develop to master March 6, 2024 18:14
@kelliemac kelliemac marked this pull request as ready for review March 6, 2024 18:43
@slager
Copy link
Contributor

slager commented Mar 6, 2024

I'm conflicted about this approach. On the one hand, it's super handy to have the PDF render on PR. On the other hand, like you say, git/GitHub aren't designed to track PDF/DOCX files and it will bloat the repo with each successive render that's committed. There also isn't the ability to diff PDF files in a useful way to see what exactly has changed, besides just doing a visual check.

I'd probably advocate the approach of just having the PR author and/or reviewer build the PDF on their own machine from the PR branch, but it might also be possible to set up this GitHub Action to render the PDF to somewhere on the cloud for viewing, without actually committing it into the repo. Something like this?

https://sha.ws/posts/automatic-upload-to-google-cloud-storage-with-github-actions/

@kelliemac
Copy link
Contributor Author

All good points, Dave, and some of the same concerns I had. I just learned that you can save "artifacts" from GitHub actions and I think this may be the best solution: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts

I'm going to mark this PR as draft and try that approach instead.

@kelliemac kelliemac marked this pull request as draft March 6, 2024 21:44
@slager
Copy link
Contributor

slager commented Mar 6, 2024

Oh, very cool! That approach sounds like it could be the best of both worlds.

@kelliemac kelliemac marked this pull request as ready for review March 6, 2024 22:22
@kelliemac
Copy link
Contributor Author

Okay, I successfully switched to the "artifacts" approach. You can now see the rendered pdf and docx by viewing the details of the render-skeleton-rmd GitHub action, for example the latest run is here: https://github.com/FredHutch/VISCtemplates/actions/runs/8179544879#artifacts

Clicking on the artifact name will download a zip file with both pdf and docx, which can easily be viewed and reviewed. No files are committed to the repo, though, so there won't be any bloating.

@kelliemac
Copy link
Contributor Author

Note that this is still only rendering the visc_empty skeleton.Rmd, as there are additional complexities with rendering the visc_report skeleton.Rmd (but I can work on that too if people feel it is important - the challenge is that additional child Rmds are assumed to be in particular locations, such as background.Rmd, so a little more setup is required).

@slager
Copy link
Contributor

slager commented Mar 6, 2024

This is so cool

@kelliemac
Copy link
Contributor Author

Thanks for reviewing and giving feedback, @slager !

@mayerbry mayerbry merged commit b9356c8 into master Mar 29, 2024
6 checks passed
@kelliemac kelliemac deleted the gh-action-render-skeleton-rmd branch March 29, 2024 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants