'No such file or directory' Error when running scheduled github action

Dear github actions support community,

I have a cron-job that runs once per week and executes an R script by taking as input a number of variables. If I push to the Github repository or click on the ‘Run’ button of the Github action then it runs successfully. However, it gives the error message ‘No such file or directory’ when it runs on the scheduled time, i.e. once per week. You can see the previous workflows in the following weblink:


I tried various thinks to make it work, however none has worked. In the same .yml file there are multiple calls to the ‘Rscript’ command and although the majority work the specific ‘Rscript’ that takes the environment variables doesn’t.

I attach in this message also the error that I receive in form of a screenshot,

The ‘R_templates’ folder that includes the ‘data_template.R’ file is in the working directory of the github action step because I’ve specified:

working-directory: ${{ github.workspace }}

and I also checked this by using,

ls -a

Hopefully it’s something obvious and simple that I’m not aware of. I also took a look to previous similar issues with the same error message (‘No such file or directory’ ) where the issues were related to the upper and lower case sensitivity, however I’ve used the exact names of folders and files in my .yml file.

Thank you in advance and for your time.

This part of the workflow is your problem:

      - uses: actions/checkout@v2
        if: github.event_name == 'pull_request'
          fetch-depth: 0
          ref: ${{ github.event.pull_request.head.ref }}
      - uses: actions/checkout@v2
        if: github.event_name == 'push'
          fetch-depth: 0

The if conditions on the two actions/checkout effectively mean that checkout will only happen for push or pull_request events, not on the scheduled run. So your repository data isn’t available. One simple fix would be to change the second condition to github.event_name != 'pull_request'.

@airtower-luna thank you very match, your answer was the solution to the mentioned issue.

1 Like