-
Notifications
You must be signed in to change notification settings - Fork 17
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: install latest node if setup-node fails #186
fix: install latest node if setup-node fails #186
Conversation
.github/workflows/repo_tests.yaml
Outdated
- repo: trunk-io/trunk-action | ||
ref: main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we somehow verify that the first pass of setup-node here will fail? or choose another repo where that's guaranteed?
i can totally see us pinning a valid engine in trunk-action, which is why this test makes me nervous
setup-env/action.yaml
Outdated
cat >>$GITHUB_ENV <<EOF | ||
FAILED_NODE_INSTALL=true | ||
EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cat >>$GITHUB_ENV <<EOF | |
FAILED_NODE_INSTALL=true | |
EOF | |
echo "FAILED_NODE_INSTALL=true" >>$GITHUB_ENV |
Continues if the setup-node action fails to install, and then installs latest node if there is no node version installed. Judging by this website showing note compatibilities, node is almost entirely backwards compatible, which is why I went with the latest version rather than e.g. node 20.
Additionally, adds a node version to the package.json so that this PR can merge - the v1 action version still chokes when not finding the node version.
This is tested by adding the trunk-action repo to the repo tests, which does not have a node version in main. However, the runners have node installed, so the action doesn't attempt to install a default version - I'm not sure if there's a better way to test that/if it's worth it.