Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for environments without remote cache #91

Merged
merged 4 commits into from
Jun 16, 2021

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Jun 16, 2021

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 the ACT 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 the ACT env var, I opted to go for improved error handling.

Right now it checks on these two errors:

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:

    1. Describing what the action will do with this error.
    2. Passing the actual encountered error for debugging purposes.
  • 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!

$ act --secrets EXPO_TOKEN=<token>

That should produce this output:

From cache To cache
Screenshot 2021-06-16 at 15 45 37 Screenshot 2021-06-16 at 15 47 04

@byCedric byCedric requested a review from jonsamp June 16, 2021 13:51
@byCedric byCedric changed the title feature: add support for environments without remote cache fix: add support for environments without remote cache Jun 16, 2021
Copy link
Member

@jonsamp jonsamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on!

@byCedric byCedric merged commit 9c0e696 into master Jun 16, 2021
@byCedric byCedric deleted the act-compatibility branch June 16, 2021 22:48
github-actions bot pushed a commit that referenced this pull request Jun 17, 2021
## [5.5.0](5.4.0...5.5.0) (2021-06-17)

### New features

* switch to node 14 for the action itself ([f13b0ea](f13b0ea))

### Bug fixes

* add support for environments without remote cache ([#91](#91)) ([9c0e696](9c0e696))

### Code changes

* simplify typescript config with community config ([#94](#94)) ([da4e754](da4e754))
* update all dependencies to latest versions ([#93](#93)) ([6bc0bed](6bc0bed))

### Other chores

* add semantic release for easy versioning ([#95](#95)) ([6354b0a](6354b0a))
* fix the allowed branches for semenatic release ([6b8c488](6b8c488))
* mock the github actions warning to avoid leaking annotations ([#96](#96)) ([a11a47a](a11a47a))
* tweak the release workflow ([79ebfbc](79ebfbc))

### Documentation changes

* add missing release step to contributing guide ([04e3b32](04e3b32))
@github-actions
Copy link

🎉 This PR is included in version 5.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Being able to run this action locally
2 participants