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: install latest node if setup-node fails #186

Conversation

puzzler7
Copy link
Contributor

@puzzler7 puzzler7 commented Sep 12, 2023

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.

Comment on lines 108 to 109
- repo: trunk-io/trunk-action
ref: main
Copy link
Contributor

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

Comment on lines 93 to 95
cat >>$GITHUB_ENV <<EOF
FAILED_NODE_INSTALL=true
EOF
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cat >>$GITHUB_ENV <<EOF
FAILED_NODE_INSTALL=true
EOF
echo "FAILED_NODE_INSTALL=true" >>$GITHUB_ENV

@puzzler7 puzzler7 merged commit 632304d into main Sep 13, 2023
37 of 38 checks passed
@puzzler7 puzzler7 deleted the maverick/trunk-8777-install-reasonable-default-node-version-if-setup-node-fails branch September 13, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants