1
0
Fork 0
mirror of https://github.com/imjasonh/govulncheck-action synced 2026-07-07 00:12:55 +00:00

Fix action runtime by bundling dependencies with ncc

The action was failing with "Cannot find module '@actions/core'" because
node_modules weren't available at runtime. This commit fixes the issue by:

- Adding @vercel/ncc to bundle all dependencies into a single dist/index.js file
- Updating action.yml to point to the bundled dist/index.js
- Adding a build script to compile the action
- Including the dist/ directory in the repository (standard for GitHub Actions)

This is the recommended approach for JavaScript-based GitHub Actions to ensure
all dependencies are available at runtime without requiring npm install.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jason Hall 2025-06-06 23:46:19 -04:00
parent ae5c462368
commit f4a3fa7150
Failed to extract signature
5 changed files with 27854 additions and 3 deletions

5
.gitignore vendored
View file

@ -11,4 +11,7 @@ example/example
*.exe
*.dll
*.so
*.dylib
*.dylib
# Don't ignore the compiled output
!dist/

View file

@ -16,4 +16,4 @@ outputs:
runs:
using: 'node20'
main: 'index.js'
main: 'dist/index.js'

27835
dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

11
package-lock.json generated
View file

@ -14,6 +14,7 @@
"@actions/github": "^6.0.0"
},
"devDependencies": {
"@vercel/ncc": "^0.38.1",
"jest": "^29.7.0"
}
},
@ -1249,6 +1250,16 @@
"dev": true,
"license": "MIT"
},
"node_modules/@vercel/ncc": {
"version": "0.38.3",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
"dev": true,
"license": "MIT",
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/ansi-escapes": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",

View file

@ -4,6 +4,7 @@
"description": "A minimal GitHub Action implemented in Node.js",
"main": "index.js",
"scripts": {
"build": "ncc build index.js -o dist",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
@ -20,7 +21,8 @@
"@actions/exec": "^1.1.1"
},
"devDependencies": {
"jest": "^29.7.0"
"jest": "^29.7.0",
"@vercel/ncc": "^0.38.1"
},
"jest": {
"testEnvironment": "node",