Github Actions workspace is empty

According to the documentation for the GITHUB_WORKSPACE environment variable here: https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables, the Github workspace patch should contain a copy of the source code.

However, this appears to not be the case. The directory is empty when I use it as the working directory and run ls.

My workflow looks like this:

name: Publish the website  
  
on:  
 push:  
 branches:  
 - test-site  
  
jobs:  
 publish:  
 name: Publish site  
runs-on: ubuntu-latest  
steps:  
 - name: Build site assets  
working-directory: ${{ github.workspace }}  
run: ls -la  
- name: Publish site to calcite-site repository  
working-directory: site  
run: echo Publishing..  

Is Github Actions suppose to include a copy of the repository in the working directory or should I use the checkout action to check a copy out?

4 Likes

Coming from the “old” (HCL-based) GitHub Actions, I ran into this problem, too.

I think you do have to use the checkout action first, though. That solved my problem.

Like so:

steps:
      - uses: actions/checkout@v1

I verified that without it ls github/workspace is completely empty.

I think they might have just copied the part of the docs from the old version. Will send an email to support.

Ps.: can’t believe these forums don’t support GitHub markdown syntax :( 

4 Likes

wrote this to support:

Hi octocats,

This is about the new, YML-based GitHub actions.

As per the new docs, I understand that I always need torun a checkout action to use my repo content.

Also in the docs, there’s still this part:

> The GitHub workspace directory path. The workspace directory contains a subdirectory with a copy of your repository.

I think this might be in error, perhaps copy/pasted from the old HCL-based GitHub actions.

If I understand correctly, the new GitHub actions always creates GITHUB_WORKSPACE, maps it, but leaves it empty by default.

Right?

3 Likes

Thanks for confirming @maxheld83! It looks like the documentation just needs to be updated.