chore(deps): bump @actions/core from 2.0.2 to 3.0.0 (#716)

* chore(deps): bump @actions/core from 2.0.2 to 3.0.0

Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 2.0.2 to 3.0.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): update build process for ESM-only @actions/core v3 (#717)

* Initial plan

* feat: update build process for ESM-only @actions/core v3

- Add "type": "module" to package.json for ESM support
- Update TypeScript config to output ES2022 modules with esModuleInterop
- Convert Jest config to ESM (.mjs) with proper ts-jest ESM preset
- Rename .prettierrc.js to .prettierrc.cjs for CommonJS compatibility
- Replace actions-toolkit with @actions/github for ESM compatibility
- Configure Jest to handle ESM modules from @actions packages
- Update test script to use NODE_OPTIONS for experimental VM modules
- Build now outputs ESM format successfully

Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>

* fix: use getInput for github_token instead of process.env

Properly access github_token input using the getInput helper function
from io.ts instead of directly accessing process.env.

Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>

* refactor: remove unnecessary moduleNameMappers from Jest config

The explicit moduleNameMappers for @actions/core and @actions/github were
not needed. The transformIgnorePatterns configuration is sufficient to
handle ESM modules from @actions packages. Only the relative import
mapper is required for TypeScript ESM compatibility.

Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2026-02-28 12:58:11 +01:00
committed by GitHub
parent af611dd65b
commit 1539a6ad10
9 changed files with 174 additions and 855 deletions

View File

@@ -1,5 +0,0 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};

20
jest.config.mjs Normal file
View File

@@ -0,0 +1,20 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
transformIgnorePatterns: [
'node_modules/(?!(@actions/core|@actions/github|@actions/http-client)/)',
],
};

21
lib/index.js generated

File diff suppressed because one or more lines are too long

3
lib/package.json generated Normal file
View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

942
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
"name": "add-and-commit",
"version": "9.1.4",
"private": true,
"type": "module",
"description": "Add & commit files from a path directly from GitHub Actions",
"main": "lib/index.js",
"scripts": {
@@ -9,13 +10,13 @@
"build": "ncc build src/main.ts --minify --out lib",
"lint": "gts lint",
"prepare": "husky",
"test": "jest && npm run lint",
"test": "NODE_OPTIONS='--experimental-vm-modules' jest && npm run lint",
"clean": "gts clean",
"fix": "gts fix"
},
"dependencies": {
"@actions/core": "^2.0.2",
"actions-toolkit": "github:EndBug/actions-toolkit#core-actions",
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"js-yaml": "^4.1.1",
"simple-git": "^3.18.0",
"string-argv": "^0.3.2"

View File

@@ -1,31 +1,23 @@
import {parseArgsStringToArgv} from 'string-argv';
import * as core from '@actions/core';
import * as YAML from 'js-yaml';
import {Toolkit} from 'actions-toolkit';
import {getOctokit} from '@actions/github';
import * as fs from 'fs';
import {input, output} from './io';
import {getInput} from './io';
type RecordOf<T extends string> = Record<T, string | undefined>;
let tools: Toolkit<RecordOf<input>, RecordOf<output>> | undefined;
function getToolkit() {
if (!tools) {
tools = new Toolkit<RecordOf<input>, RecordOf<output>>({
secrets: [
'GITHUB_EVENT_PATH',
'GITHUB_EVENT_NAME',
'GITHUB_REF',
'GITHUB_ACTOR',
],
});
function getOctokitClient() {
const token = getInput('github_token');
if (!token) {
throw new Error('github_token is required');
}
return tools;
return getOctokit(token);
}
export async function getUserInfo(username?: string) {
if (!username) return undefined;
const res = await getToolkit().github.users.getByUsername({username});
const octokit = getOctokitClient();
const res = await octokit.rest.users.getByUsername({username});
core.debug(
`Fetched github actor from the API: ${JSON.stringify(res?.data, null, 2)}`,

View File

@@ -4,7 +4,10 @@
"rootDir": ".",
"outDir": "./lib",
"composite": false,
"declaration": false
"declaration": false,
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true
},
"include": [
"src/**/*.ts",