Help
cancel
Showing results for 
Search instead for 
Did you mean: 
F21
Copilot Lvl 2
Message 1 of 4

Github Actions workspace is empty

Solved! Go to Solution.

According to the documentation for the GITHUB_WORKSPACE environment variable here: https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-vari..., 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?

3 Replies
Solution
Copilot Lvl 3
Message 2 of 4

Re: Github Actions workspace is empty

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 :( 

 

Highlighted
Copilot Lvl 3
Message 3 of 4

Re: Github Actions workspace is empty

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 to run 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?

F21
Copilot Lvl 2
Message 4 of 4

Re: Github Actions workspace is empty

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