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

[TODAY] Github Actions - Genera an error #143

Closed
okarook opened this issue Jan 6, 2023 · 10 comments
Closed

[TODAY] Github Actions - Genera an error #143

okarook opened this issue Jan 6, 2023 · 10 comments

Comments

@okarook
Copy link

okarook commented Jan 6, 2023

Describe the bug
My Github action has an error
This error occurred today, yesterday everything was fine

Workflow
This is my action

name: Semantic Release
on:
  push:
    branches: [ production ]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 16.17.0

      - name: Install Dependencies
        run: yarn install

      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v2
        id: semantic  
        with:
          branch: production
        env:
          GITHUB_TOKEN: ${{ secrets.XXXX }}
  

Expected behavior
This action should work in my GitHub

Additional context
I have seen that the semantic-release package a few minutes ago updated to a new version.

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jan 8, 2023

@okarook

I'm also seeing the error using cycjimmy/semantic-release-action@v2. There was a release of semantic-release v20.0.0 on Jan 6, 2023. According to the release notes it contains breaking changes related to ESM-only and minimum Node.js 18.

If possible it is probably best just to update to using cycjimmy/semantic-release-action@v3 which also gets rid of some deprecation warnings.

Upgrade to cycjimmy/semantic-release-action@v3

Upgrading to v3 of cycjimmy/semantic-release-action without specifying semantic_version resolves this issue. It seems that this is because a default version is specified in the action:

"semantic-release": "^19.0.5"

semantic_version

Adding semantic_version works around the issue when using the previous v2 version cycjimmy/semantic-release-action@v2:

    with:
      semantic_version: 19

This is according to the README section for the parameter semantic_version where it says:

"It is recommended to manually specify a version of semantic-release to prevent errors caused during the official semantic-release upgrade"

After making the change the log files then show:

[semantic-release] › ℹ  Running semantic-release version 19.0.5

instead of:

Error: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/semantic-release/index.js

@cycjimmy
Copy link
Owner

cycjimmy commented Jan 9, 2023

This is caused by BREAKING CHANGES in semantic-release v20. You can temporarily lock the version to v19 to solve this problem.

with:
  semantic_version: 19

https://github.com/semantic-release/semantic-release/releases/tag/v20.0.0

@MikeMcC399
Copy link
Contributor

@cycjimmy

Are you planning any new release of cycjimmy/semantic-release-action to support v20 of semantic-release/semantic-release?

@cycjimmy
Copy link
Owner

cycjimmy commented Jan 9, 2023

Yes. But this action uses a Javascript container. Currently, the only Javascript containers available on Github are node12 and node16, and semantic-release v20 requires node18 or higher. So we may have to wait a little longer.

@cycjimmy

Are you planning any new release of cycjimmy/semantic-release-action to support v20 of semantic-release/semantic-release?

@MikeMcC399
Copy link
Contributor

@cycjimmy

Yes. But this action uses a Javascript container. Currently, the only Javascript containers available on Github are node12 and node16, and semantic-release v20 requires node18 or higher.

Thank you for pointing out this compatibility issue!

Issue actions/runner#2255 requesting support for node18 was closed with the hint that the next supported version may be node20.

According to https://github.com/nodejs/release#release-schedule Node.js 20 is planned for release on 2023-04-18

So we may have to wait a little longer.

You are right! Probably this means quite a few months:
Release of Node.js 20 > Support on GitHub

@okarook
Copy link
Author

okarook commented Jan 10, 2023

Thanks, I don't have the version on the GitHub Action ✌️

@MikeMcC399
Copy link
Contributor

@okarook

Please let us know if the suggested fixes (add

    with:
      semantic_version: 19

or update to @V3, or add the version together with updating to @V3) fixed the issue for you.

anderssonjohan added a commit to Lundalogik/trainee-release-with-git that referenced this issue Jan 12, 2023
avoids "Error [ERR_REQUIRE_ESM]: Must use import to load ES Module" described by cycjimmy/semantic-release-action#143
anderssonjohan added a commit to Lundalogik/trainee-release-with-git that referenced this issue Jan 12, 2023
avoids "Error [ERR_REQUIRE_ESM]: Must use import to load ES Module" described by cycjimmy/semantic-release-action#143
@buehler
Copy link

buehler commented Jan 17, 2023

Would it be an option to move to a docker based github action? Then you can adjust your node version quite easily. Or are there any implications that I don't see?

@MikeMcC399
Copy link
Contributor

@okarook

If you are now back up and running, then I suggest to close this issue.

README: Semantic version has been updated to give the correct advice based on the discussions here in this issue.

Thanks for reporting this issue. It was very useful to me!

@MikeMcC399
Copy link
Contributor

@cycjimmy

In case you hadn't seen it
actions/runner#2704
announced the plan to support node20 for GitHub JavaScript Actions.

No date yet.

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

No branches or pull requests

4 participants