fix: add support for environments without remote cache #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked issue
Testing your workflow in Github actions might not be the best DX. Having this action work with nektos/act would be great to have.
fixes #90
The change
I was looking at detecting if the action is running in the
act
environment, by checking if theACT
environment variable is set. But, I assume the cache might not always be available, like on custom runners or enterprise Github users. Instead of checking on theACT
env var, I opted to go for improved error handling.Right now it checks on these two errors:
ReserveCacheError
Cache Service Url not found
.Additional context
Adding error handling is tricky, we should never obfuscate the actual error. That's why I kept the error report in two lines:
Another thing I noticed is if you forgot to add the secret, and Expo requires to authenticate, it fails to recognize the CLI is running in non-interactive mode. I think that might be an error in act, if you run into this you have to manually force close docker/cli.
How to use it
I've run this change locally on bycedric/office-marathon using the smallest Docker instance from act. That seems to work fine!
That should produce this output: