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

Error on Workflow run #5

Open
nnellanspdl opened this issue Jun 6, 2024 · 1 comment
Open

Error on Workflow run #5

nnellanspdl opened this issue Jun 6, 2024 · 1 comment

Comments

@nnellanspdl
Copy link

I'm trying to use this in our Organization and running into a problem. I've configured everything properly. A user has submitted an Issue requesting a license, and the workflow gives the following error. Any idea what I can do here to resolve this?

  with:
    script: const { Octokit } = require("@octokit/action");            
  const octokit = new Octokit(); 
  await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', {
    issue_number: context.issue.number,
    owner: context.repo.owner,
    repo: context.repo.repo,
    body: 'Failed assigning the GitHub Copilot license. Please contact the organization administrator.',
    content: 'confused',
    headers: {
      'X-GitHub-Api-Version': '2022-11-28'
    }
  });
  
    github-token: ***
    debug: false
    user-agent: actions/github-script
    result-encoding: json
    retries: 0
    retry-exempt-status-codes: 400,401,403,404,422
  env:
    GITHUB_TOKEN: ***
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/my_repo/my_repo/node_modules/@octokit/action/dist-bundle/index.js from /home/runner/work/_actions/actions/github-script/v7/dist/index.js not supported.
Instead change the require of /home/runner/work/my_repo/my_repo/node_modules/@octokit/action/dist-bundle/index.js in /home/runner/work/_actions/actions/github-script/v7/dist/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.apply (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35477:23)
    at eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35424:16), <anonymous>:3:21)
    at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35425:12)
    at main (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35522:26)
    at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:35497:1 {
  code: 'ERR_REQUIRE_ESM'
}
Error: Unhandled error: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/my_repo/my_repo/node_modules/@octokit/action/dist-bundle/index.js from /home/runner/work/_actions/actions/github-script/v7/dist/index.js not supported.
Instead change the require of /home/runner/work/my_repo/my_repo/node_modules/@octokit/action/dist-bundle/index.js in /home/runner/work/_actions/actions/github-script/v7/dist/index.js to a dynamic import() which is available in all CommonJS modules.
@nnellanspdl
Copy link
Author

nnellanspdl commented Jun 6, 2024

It looks like the NPM package for octokit/action was updated recently to 7.0.0 and had breaking changes: https://github.com/octokit/action.js/releases

I updated my copilot workflow file to use the older version and it worked:

# original
- run: npm install @octokit/action

# updated
- run: npm install @octokit/[email protected]

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

1 participant