1

I'm trying to build a Github Action that's going to take a screenshot of the Github Pages website (built with Jekyll) and allow the user to upload it as an artifact. For my convienience and since installing Pyppeteer is non-trivial, I wrapped the thing around in Docker. Here's the source code for the action at the time of writing the question:

https://github.com/hakierspejs/jekyll-screenshot-github-action/tree/8569f1370c5decf5ecfb4bc17a977cad5aa3d2aa

The problem is in accessing the source code of the Github Pages website. I noticed that Github Actions is mapping a couple of directories as a volume, but neither /github/workflow nor /github/workspace seems to contain the source code. Is there a path I could mount to somehow access it?

d33tah
  • 10,999
  • 13
  • 68
  • 158
  • There is a `GITHUB_WORKSPACE` [environment variable](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables). That should be the path to the checked out repo. – peterevans Feb 16 '20 at 15:16
  • @peterevans somehow it's empty: https://github.com/d33tah/homepage/runs/448804873?check_suite_focus=true – d33tah Feb 16 '20 at 16:41
  • [This doesn't look right](https://github.com/hakierspejs/jekyll-screenshot-github-action/blob/master/screenshot.py#L20) to me. By default, container actions should run with the checked out repository relative to its execution. So the website you want to serve should be at `./`, no? – peterevans Feb 17 '20 at 01:40
  • @peterevans I added the answer. – d33tah Feb 17 '20 at 09:05

1 Answers1

0

/github/workflow is the right path, but I was missing a actions/checkout@master step. Adding this line to the list of steps made it work:

- uses: actions/checkout@master
d33tah
  • 10,999
  • 13
  • 68
  • 158