Error using R markdown with GitHub actions

I'm new to GitHub actions and am trying to use if for my first automation. I've got an RMD which works on Windows, an renv lockfile with all my packages in and a yaml - see below:

on:
  schedule:
    - cron: "35 14 */1 * *" # Every two days at 12:13 AM
    
jobs:
  render-rmarkdown:
    runs-on: ubuntu-latest
    # optionally use a convenient Ubuntu LTS + DVC + CML image
    #container: docker://dvcorg/cml:latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup R
        uses: r-lib/actions/setup-r@v2
      
      - name: Setup dependencies
        run: |
         R -e 'install.packages("remotes")' 
         R -e 'library(remotes)' 
       
      - name: Install system dependencies
        
        if: runner.os == 'Linux'
        run: |
          while read -r cmd
          do
            eval sudo $cmd
          done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
              
        
      - name: Setup Pandoc
        uses: r-lib/actions/setup-pandoc@v2
        
      - name: Setup renv  
        uses: r-lib/actions/setup-renv@v2
                
      - name: Identify and email 
        #env: 
        #  repo_token: ${{ secrets.GITHUB_TOKEN }} 
        run: |
         Rscript -e 'rmarkdown::render(input = "My_Markdown.Rmd")'
            if [[ "$(git status --porcelain)" != "" ]]; then
            git config --local user.name "$GITHUB_ACTOR"
            git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
            git add *
            git commit -m "Auto update Report"
            git push origin
          fi

I've had so many problems getting this running and been on various help forums and was hoping I was almost there - but I'm now getting the error install of package 'curl' failed [error code 1] As you can see from the yaml, I found this thread on here and followed the advice to change the yaml - but its still not working. Any help would be much appreciated, it's driving me insane!

Hi Jeremy!

I've stumbled upon a similar issue with GHA and {curl} installation.
As pointed out in the link you provided, it seems that this issue might be related to a missing dependency: libcurl.

One possible solution would be to explicitly add a step to install this dependency (I just added a step for this in theyaml file you provided):

on:
  schedule:
    - cron: "35 14 */1 * *" # Every two days at 12:13 AM
    
jobs:
  render-rmarkdown:
    runs-on: ubuntu-latest
    # optionally use a convenient Ubuntu LTS + DVC + CML image
    #container: docker://dvcorg/cml:latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup R
        uses: r-lib/actions/setup-r@v2
      
      - name: Install libcurl
        run: >
          sudo apt-get update && sudo apt-get install --yes
          libcurl4-openssl-dev
          
      - name: Setup dependencies
        run: |
         R -e 'install.packages("remotes")' 
         R -e 'library(remotes)' 
       
      - name: Install system dependencies
        
        if: runner.os == 'Linux'
        run: |
          while read -r cmd
          do
            eval sudo $cmd
          done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
               
      - name: Setup Pandoc
        uses: r-lib/actions/setup-pandoc@v2
        
      - name: Setup renv  
        uses: r-lib/actions/setup-renv@v2
                
      - name: Identify and email 
        #env: 
        #  repo_token: ${{ secrets.GITHUB_TOKEN }} 
        run: |
         Rscript -e 'rmarkdown::render(input = "My_Markdown.Rmd")'
            if [[ "$(git status --porcelain)" != "" ]]; then
            git config --local user.name "$GITHUB_ACTOR"
            git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
            git add *
            git commit -m "Auto update Report"
            git push origin

Hope this helps!


This post was published by an Appsilon) team member. Our company can help you get the most out of RShiny and Posit/RStudio products.

Check our open positions here.

Appsilon: Building impactful RShiny Dashboards and providing R coding services.
Appsilon_GIFsmall_whitebg

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.