actions / checkout

Action for checking out a repo

Home Page:https://github.com/features/actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails with SyntaxError after recent NPM dependencies update

dylanhand opened this issue · comments

As of version 4.1.4 As of commit 9c1e94e (#1703), my CI builders are broken with the following error:

Running clone
Running:  node $HOME/tasks/$TASK_ID/_temp/actions/checkout/dist/index.js
+ node /root/tasks/xxxxx/_temp/actions/checkout/dist/index.js
/root/tasks/xxxxx/_temp/actions/checkout/dist/index.js:7620
static {
^
SyntaxError: Unexpected token '{'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
Process exited with code: 1

Caused by line 7620 in dist/index.js, introduced 5 days ago.

I'm guessing the solution is to upgrade node, but thought I'd mention it in case this is unexpected.

The changes to index.js were minimal in v4.1.4. They were also fairly minimal over the past several releases, with no changes beyond line 2410.

Since releasing v4.1.4, index.js has changed much more extensively as the result of #1703, but those changes are yet to be released.

Image


How are you referencing actions/checkout in your workflow? Can you please include a YML snippet?

Good catch, I wrongly indicated this was because of v4.1.4, but you're right that it was the following commit that broke things for me (#1703) :)

We're using Taskcluster for CI and currently access actions/checkout by simply cloning the repo and using the main branch. We should probably make it possible to pin to a version/tag, but it's never been a problem before.

My current workaround is to checkout the releases/v4.0.0 branch.

The CI machine that has issues is running node v16, which I'm guessing needs an update to support the latest changes.

In the meantime, referencing the commit by SHA should also work (e.g. yourfork/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b)

The CI machine that has issues is running node v16, which I'm guessing needs an update to support the latest changes.

If your runners are on Node 16, you should stick with the v3 tag until you can update the Node version. Checkout (and most first party GH actions) typically use these major version bumps with changes to the available Node runtime. e.g. https://github.com/actions/checkout/releases/tag/v4.0.0

If your runners are on Node 16, you should stick with the v3 tag until you can update the Node version. Checkout (and most first party GH actions) typically use these major version bumps with changes to the available Node runtime. e.g. https://github.com/actions/checkout/releases/tag/v4.0.0

Good to know, thanks for the info :)