Skip to content

Commit 24266b5

Browse files
committed
fix module imports
1 parent b479791 commit 24266b5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.github/scripts/validate-and-merge.js renamed to .github/scripts/validate-and-merge.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { createRequire } from 'module';
2+
const require = createRequire(import.meta.url);
13
const fs = require('fs');
2-
const { Octokit } = require('@octokit/rest');
34

4-
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
5+
56

67
const owner = process.env.REPO_OWNER;
78
const repo = process.env.REPO_NAME;
@@ -18,6 +19,8 @@ const requiredKeys = [
1819
];
1920

2021
async function validateAndMerge() {
22+
const { Octokit } = await import('@octokit/rest');
23+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
2124
try {
2225
const { data: pr } = await octokit.pulls.get({
2326
owner,

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
PR_NUMBER: ${{ github.event.pull_request.number }}
2222
REPO_OWNER: ${{ github.repository_owner }}
2323
REPO_NAME: ${{ github.event.repository.name }}
24-
run: node .github/scripts/validate-and-merge.js
24+
run: node --experimental-modules .github/scripts/validate-and-merge.js

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"author": "",
1010
"license": "ISC",
11+
"type": "module",
1112
"dependencies": {
1213
"@octokit/rest": "^21.0.2"
1314
}

0 commit comments

Comments
 (0)