⚡ JavaScript Action with ES Modules is the complete English-language guide to building modern custom GitHub Actions in JavaScript using native ES Modules. Learn how to structure action.yml, use node20 runtime, import local and npm modules, bundle with esbuild, handle inputs and outputs, and test your action in real workflows. Built for DevOps engineers, maintainers, and developers who want to ship CI tooling the right way. Completely free. No signup. No paywall. No hidden chapters.
Most GitHub Actions tutorials still use CommonJS with require() and old node16. This guide is fully modern — pure ES Modules, node20 runtime, import / export, and esbuild-based bundling. Every snippet is tested on real GitHub workflows.
|
|
|
|
| Step | Action | Time |
|---|---|---|
| 1 | Scaffold the action repo | ~3 min |
| 2 | Add action.yml |
~5 min |
| 3 | Write main.mjs |
~10 min |
| 4 | Bundle with esbuild | ~5 min |
| 5 | Test in a workflow | ~10 min |
| 6 | Publish the action | ~5 min |
💡 Tip: Always commit the bundled
dist/index.mjs— GitHub Actions runs the bundle, not your source.
| Feature | Description | Status |
|---|---|---|
| 🧩 action.yml | Modern metadata | ✅ Active |
| ⚡ node20 Runtime | Latest supported | ✅ Active |
| 📦 ES Modules | import / export |
✅ Active |
| 🔨 esbuild Bundle | Single file output | ✅ Active |
| 🎛️ Inputs + Outputs | @actions/core |
✅ Active |
| 🧪 Test Workflow | Real CI run | ✅ Active |
|
|
|
|
| Term | Description |
|---|---|
| Action | Reusable CI step |
| action.yml | Metadata file |
| node20 | Supported runtime |
| ESM | ES Modules |
| esbuild | Fast bundler |
| @actions/core | Inputs/outputs API |
Why use it?
- ✅ Reusable across repos
- ✅ Modern ES Modules
- ✅ No Docker needed
- ✅ Runs on any runner
- ✅ Free guide
| Type | Description | Best For |
|---|---|---|
| JS Action | Node.js code | Most cases |
| Composite | YAML steps | Simple glue |
| Docker | Container | Heavy deps |
| Reusable WF | Full workflow | Orchestration |
| ES Modules | import/export |
Modern JS |
| CommonJS | Legacy | Older setups |
| Feature | Before | After |
|---|---|---|
| Runtime | node16 | ✅ node20 |
| Modules | CommonJS | ✅ ESM |
| Bundle | ncc | ✅ esbuild |
| Source | One file | ✅ Modules |
| Testing | Manual | ✅ Real CI |
| Price | Paid courses | ✅ Free guide |
| Platform | Status | Notes |
|---|---|---|
| GitHub Actions | ✅ Supported | All runners |
| Ubuntu Runner | ✅ Supported | Best support |
| Windows Runner | ✅ Supported | Native |
| macOS Runner | ✅ Supported | Native |
| Self-Hosted | ✅ Supported | Any |
| Local act | ✅ Supported | Local test |
| Component | Description | Format |
|---|---|---|
| Setup Guide | Project + files | MD |
| action.yml Guide | Metadata fields | MD |
| ESM Guide | import/export | MD |
| Bundle Guide | esbuild config | MD |
| Inputs Guide | @actions/core | MD |
| Test Guide | Real workflow | MD |
| Component | Minimum | Recommended |
|---|---|---|
| OS | Any modern OS | Latest |
| CPU | Dual-core 1.8 GHz | Quad-core 3.0 GHz+ |
| RAM | 2 GB | 8 GB |
| Storage | 200 MB | 1 GB |
| Node | 18+ | 20+ |
| Git | 2.30+ | Latest |
Create the repo and src/ folder.
Set runs.using: node20 and main: dist/index.mjs.
Write the entry with import.
Run esbuild to output dist/index.mjs.
Add a test workflow to .github/workflows/.
Tag a release and use uses: you/action@v1.
- Scaffold the repo
- Configure
action.yml - Write
main.mjs - Bundle with esbuild
- Test in a workflow
- Publish
- ✅ Commit
dist/ - ✅ Use
node20 - ✅ Validate inputs
- ✅ Log with
core.info - ✅ Tag releases
- ✅ Prefer esbuild over ncc
- ✅ Keep source modular
- ✅ Add tests
- ✅ Document inputs
- ✅ Version tags
| Problem | Solution |
|---|---|
| "Cannot find module" | Commit dist/ |
| Wrong runtime | Set node20 |
| Inputs empty | Check with: |
| Bundling fails | Add esbuild config |
| Action not found | Tag release |
| Permission error | Check permissions: |
Is this guide free?
Yes — completely free to read.Does it use ES Modules?
Yes — pure `import`/`export`.Is node20 supported?
Yes — this is the modern runtime.Do I need Docker?
No — JS actions don't require it.How do I bundle?
esbuild is covered in full.Can I test locally?
Yes — with `act`.Does it cover publishing?
Yes — tag + release guide.Is it beginner-friendly?
Yes — starts from scaffold.| ✅ Allowed | ❌ Forbidden |
|---|---|
| Personal use | Selling the guide |
| Commercial CI | Redistributing as paid |
| Team onboarding | Removing author credits |
| Educational use | Bundling with malware |
JavaScript Action with ES Modules is the complete guide to modern GitHub Actions:
- ✅ node20 runtime
- ✅ ES Modules
- ✅ esbuild bundling
- ✅ Inputs + outputs
- ✅ Real workflow tests
- ✅ Completely free
Ship modern actions — open the guide today.
- JavaScript Action GitHub
- ES Modules GitHub Actions
- node20 GitHub Action
- Custom Action Guide
- GitHub Action esbuild
- GitHub Actions 2026
- action.yml node20
- ESM GitHub Action
- Bundle Action esbuild
- Actions Inputs Outputs
- How to build a JavaScript GitHub Action
- Use ES Modules in GitHub Actions
- Bundle a Node20 action with esbuild
- Publish a custom GitHub Action
- Test a JavaScript action in CI
- action.yml node20 main.mjs example
GitHubActions, JavaScript, ESM, node20, CI, Free Guide, 2026
JavaScript Action with ES Modules — free guide to node20, ESM, esbuild bundling, and publishing. Build modern custom GitHub Actions. Open now!
