Github actions won't run my script on schedule

Hello again,

Please, I have written a simple web scraping application, which I want to automate with github actions. I believe I have set everything up correctly, including my YML file, but after committing, my workflow run is still "0". Please find below my YML file:

name: Aljazeera_headlines_scraper

# Controls when the action will run.
    - cron:  '*/10 * * * 1-5'

    # The type of runner that the job will run on
    runs-on: windows-latest

    # Load repo and install R
    - uses: actions/checkout@master
    - uses: r-lib/actions/setup-r@master

    # Set-up R
    - name: Install packages
      run: |
        R -e 'install.packages("rvest")'
        R -e 'install.packages("tidyverse")'
    # Run R script
    - name: Scrape
      run: Rscript Aljazeera_scraper.R
 # Add new files in data folder, commit along with other modified files, push
    - name: Commit files
      run: |
        git config --local actions-user
        git config --local ""
        git add data/*
        git commit -am "GH ACTION Headlines $(date)"
        git push origin main
        REPO_KEY: ${{secrets.GITHUB_TOKEN}}
        username: github-actions

The script I want to automate is written below:


aljurl <- read_html(paste0(""))

headlinks <- aljurl %>% 
  html_nodes(".u-clickable-card__link") %>% 

links <- data.frame(
  date = Sys.Date(),
  headline_links = headlinks

write.csv(links,file = paste0("Headlinks.csv"),append = TRUE)

I want it to scrape headline links from the news website every 10 minutes of every day, and store that in a csv file in the data folder. Nevertheless, I do not see any indication that my workflow is running; and when I check the log, I see 0 activity. Please, is there something I am not getting right? This is my first attempt at automating my R script. Thanks for your support as always.

I am not sure what you mean by the log, but it seems to me that your action is running. Click on the Actions tab in your repository.

This syntax will not work for running R on Windows, though. Try something like this:

      - name: name of the step
        run: |
           # put your R code here line by line
           # ...
        shell: Rscript {0}

E.g. actions/action.yaml at 2049ddf494c475378ff5cf3ff4ac92ec65670148 · r-lib/actions · GitHub

Thanks a lot, but it didn't resolve the issue. The run still failed. I am at a total loss on what to do now

Well, it depends what your actual errors are.

This is the error message

Run git config --local actions-user

[15]( branch main

[16]( branch is up to date with 'origin/main'.


[18]( to commit, working tree clean

[19]( Process completed with exit code 1.

It fails on the commit stage of the run

Because as the error message says, there is nothing to commit.

Probably because the previous step already fails. Here, when installing packages:

But the package install step completes. The entire process fails at the commit step, and I can't fathom why. Please, do you have any more helpful suggestions? I am really desperate now.

But the package install step completes

That does not mean that it was successful. It wasn't. If you want to run this on Ubuntu, then you'll need to install some Ubuntu packages. E.g. the curl R package needs libcurl4-openssl-dev as you see can see at this line:

Additionally, your script never runs. I would remove the empty lines from the code block, e.g. this: but the others as well.

Thanks so much for patiently helping me; I do appreciate it. I am thinking of starting all over again with a new repo. Please, can you just give me the steps to follow, so that I can correctly set up my github-actions to run my script on schedule, if it isn't too much trouble for you? I will greatly appreciate that. I will also want to use it as a reference for future projects. Thanks a lot.

This topic was automatically closed 21 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.