actions / first-interaction

An action for filtering pull requests and issues from first-time contributors
MIT License
766 stars 338 forks source link

Import error when using the action in a workflow #101

Closed joukosaastamoinen closed 2 years ago

joukosaastamoinen commented 2 years ago

Hey! Our team has been enjoying this action for a long time now, but today we started getting this error:

internal/modules/cjs/loader.js:1216
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /node_modules/@octokit/graphql/index.js
require() of ES modules is not supported.
require() of /node_modules/@octokit/graphql/index.js from /node_modules/@actions/github/lib/github.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node_modules/@octokit/graphql/package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1216:13)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/node_modules/@actions/github/lib/github.js:14:19)
    at Module._compile (internal/modules/cjs/loader.js:1200:[30](https://github.com/creditornot/ops-tools/actions/runs/3150609247/jobs/5123593663#step:3:31))
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:[32](https://github.com/creditornot/ops-tools/actions/runs/3150609247/jobs/5123593663#step:3:33))
    at Function.Module._load (internal/modules/cjs/loader.js:9[37](https://github.com/creditornot/ops-tools/actions/runs/3150609247/jobs/5123593663#step:3:38):14) {
  code: 'ERR_REQUIRE_ESM'
}
manuelhenke commented 2 years ago

Got the same issue here: https://github.com/manuelhenke/nuxt-envalid/actions/runs/3150929118/jobs/5124272833

remisture commented 2 years ago

Happens for me as well.

name: Greetings

on: [pull_request_target]

jobs:
    greeting:
        runs-on: ubuntu-latest
        permissions:
            issues: write
            pull-requests: write
        if: ${{ github.actor != 'dependabot[bot]' }}
        steps:
            - uses: actions/first-interaction@v1
              with:
                  repo-token: ${{ secrets.GITHUB_TOKEN }}
                  pr-message: 'Gratulerer med din fΓΈrste PR!'
andreamari commented 2 years ago

Same problem, since yesterday. These are our settings: https://github.com/unitaryfund/mitiq/blob/master/.github/workflows/greeting.yml

MCWertGaming commented 2 years ago

Have the same problem with the default workflow configuration

mikecentola commented 2 years ago

Just noticed the problem for one of my repos as well.

pony012 commented 2 years ago

If the action is non-blocking for your repo, you can use jobs..steps[*].continue-on-error:

name: Greetings

on: [pull_request_target]

jobs:
    greeting:
        runs-on: ubuntu-latest
        permissions:
            issues: write
            pull-requests: write
        if: ${{ github.actor != 'dependabot[bot]' }}
        steps:
            - uses: actions/first-interaction@v1
              continue-on-error: true
              with:
                  repo-token: ${{ secrets.GITHUB_TOKEN }}
                  pr-message: 'Something'
alexbbt commented 2 years ago

This action should be using release tags so that we can lock to a working version. The continue-on-error workaround is a good short-term solution.

wabscale commented 2 years ago

Same here with default configuration.

farayolaj commented 2 years ago

Just made a PR to fix this. But I don't know who is supposed to review it.

FanJups commented 2 years ago

same here https://github.com/osscameroon/js-generator/pull/137

It looks like it fails when I (as owner) open an issue, only me. That's weird!

name: Greetings

on: [pull_request, issues]

jobs:
  greeting:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      issues: write
    steps:
    - uses: actions/first-interaction@v1
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        issue-message: 'Thanks for opening this issue 😊 ! We really appreciate your work. Happy Coding πŸŽ‰πŸŽŠ !'' first issue'
        pr-message: 'Thanks for opening this pull request 😊 ! We really appreciate your work. Happy Coding πŸŽ‰πŸŽŠ !'' first pull request'
healchow commented 2 years ago

Our greeting action goes wrong too: https://github.com/apache/inlong/actions/runs/3175464176/jobs/5173530839

thyeggman commented 2 years ago

Hi everyone! Thanks for reporting this, we're aware of the issue

cory-miller commented 2 years ago

v1.1.1 of this action has been released with the change from #103. Reference to v1 has been updated to v1.1.1 as well.

pllim commented 2 years ago

Thanks!

zer0Kerbal commented 2 years ago

very much appreciated!