I have a bookdown document that renders fine on my local machine, but when I have it run as an automated process using GitHub Actions the outputs from the individual code chunks show up all jumbled up:
This is the GitHub repository for the book: https://github.com/ries9112/cryptocurrencyresearch-org
And here are where the automated runs through GitHub Actions are running: https://github.com/ries9112/cryptocurrencyresearch-org/actions
In order to help troubleshoot the problem, I created a separate repository as a much more barebones example, and I am running into the exact same issue. Here is the repository for the simpler example: https://github.com/ries9112/bookdown-test
I deployed the results from that simpler test and you can find them here: https://brave-leakey-37b898.netlify.app/intro.html#here-adding-new-test
The documents format totally fine locally, so looks like there may be something else that I need to install, but I am currently installing pandoc and tinytex, and I can't figure out what else may be missing. Here is the YAML file that defines the GitHub Action:
jobs:
build:
runs-on: macOS-10.15
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- name: Install pandoc and pandoc citeproc
run: |
brew install pandoc
brew install pandoc-citeproc
- name: Install Packages
run: |-
Rscript -e "install.packages(c('pins','bookdown','tidyverse','DT'))"
- name: Refresh book
run: |-
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"
Any thoughts on any anything that may be missing in those installation steps to get this to render correctly? I have tried on Ubuntu and Windows as well and ran into the same problems.
I also tried these steps for pandoc and tinytex install and ran into the same exact problem:
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-tinytex@v1
Would really appreciate any thoughts on how to fix this issue!
Also posted to RStudio Community and will update both with the answer if one is found.
I think you need to deactivate coloring enabled by the crayon package, which is used by the tidyverse.
By default, it is activated on Github Action when you are using setup-r
https://github.com/r-lib/actions/blob/9598b8eeb6d88de7d76d580d84443542bbfdffce/setup-r/action.yml#L14-L16
So you need to change it to FALSE
- uses: r-lib/actions/setup-r@v1
with:
crayon.enabled: 'FALSE'
in you actions yaml file.
You can also deactivate it as an option in your bookdown project
options(crayon.enabled = FALSE)
You have to do that on Github Action because crayon is not disable automatically when used in GHA. Don't know why