How do I use dependency caching for GitHub actions when listening to development_status events?

Viewed 98

I'm following this tutorial on using preview deployments to run Cypress against, but I don't want to sacrifice dependency caching.

Is there a workaround I can reach for?

So far:

I've tried using GitHub's cache action, but that has an error when attempting to write/read to cache from within a workflow that uses deployment_status as the event. According to GitHub's documentation, GITHUB_REF is undefined if the event is triggered from a commit, so everything so far makes sense.

Knowing the above, one idea I thought of was manually defining GITHUB_REF during the job's env scope, but felt like that would not work somehow. This wont work because hashFiles isn't a recognized function in this scope:

GITHUB_REF: ${{ github.ref }}-${{ hashFiles('./yarn.lock') }}

0 Answers
Related