Skip to content

Commit 541e4aa

Browse files
Copilottrwalke
andcommitted
Fix ESM/CJS issue: use dynamic import() for openai and @octokit/rest in workflow
Co-authored-by: trwalke <30090357+trwalke@users.noreply.github.com>
1 parent 6fdacd9 commit 541e4aa

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/auto-answer-issues.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ jobs:
4646
REPO_NAME: ${{ github.event.repository.name }}
4747
run: |
4848
node - << 'EOF'
49-
const { Octokit } = require("@octokit/rest");
50-
const { AzureOpenAI } = require("openai");
51-
5249
async function main() {
50+
// Use dynamic import() for ESM-only packages (openai v4+ and @octokit/rest v19+
51+
// are ESM-only; dynamic import() works from CommonJS in Node 20).
52+
const { Octokit } = await import("@octokit/rest");
53+
const { AzureOpenAI } = await import("openai");
5354
const {
5455
GITHUB_TOKEN,
5556
AZURE_OPENAI_API_KEY,

0 commit comments

Comments
 (0)