JO
joshjohanning/nodejs-actions-starter-template
Starter template with the action layout, linting, CI, and publishing pre-configured
nodejs-actions-starter-template
๐ Starter template with the action layout, linting, CI, and publishing pre-configured
A complete GitHub Action starter template that includes:
- โ Action boilerplate with inputs/outputs
- โ ESLint configuration for code quality
- โ Jest testing framework with sample tests
- โ GitHub Actions CI/CD workflow
- โ Automated bundling with ncc
- โ Example implementation that works out of the box
- โ GitHub REST API integration with Octokit
- โ Repository statistics fetching example
Getting Started
1. Use This Template
- Click "Use this template" to create a new repository
- Clone your new repository locally
- Run
npm installto install dependencies
2. Customize Your Action
๐ See TEMPLATE_CHECKLIST_DELETE_ME.md for a comprehensive customization guide
- Update
package.jsonwith your action name and details - Update
action.ymlwith your action's inputs and outputs - Modify
src/index.jswith your action logic - Update this README with your action's documentation
- Update the publish workflow if needed
3. Test Your Action
npm test # Run tests
npm run lint # Check code quality with ESLint
npm run format:write # Run Prettier for formatting
npm run coverage # Generate coverage badge
npm run package # Bundle for distribution
npm run all # Alternatively: Run format, lint, test, coverage, and packageExample Usage
- name: Hello World Action
uses: your-username/your-action-name@v1
with:
who-to-greet: 'World'
include-time: true
message-prefix: 'Hello'
github-token: ${{ secrets.GITHUB_TOKEN }} # Optional: for repo statsAction Inputs
| Input | Description | Required | Default |
|---|---|---|---|
who-to-greet |
Who to greet in the message | No | 'World' |
include-time |
Whether to include current time in output | No | false |
message-prefix |
Prefix for the greeting message | No | 'Hello' |
github-token |
GitHub token for API access (enables repo stats) | No | - |
Action Outputs
| Output | Description |
|---|---|
message |
The generated greeting |
time |
Current timestamp (if requested) |
repo-stats |
Repository statistics JSON (if token provided) |
Development
This template includes everything you need to start developing GitHub Actions:
Development Setup
- Clone this repository
- Install dependencies:
npm install - Make your changes to
src/index.js - Run tests:
npm test - Build the action:
npm run package
Available Scripts
npm test- Run Jest testsnpm run lint- Run ESLintnpm run format:write- Format code with Prettiernpm run package- Bundle the action with nccnpm run all- Run format, lint, test, coverage, and package
Testing Locally
You can test the action locally by setting environment variables:
export INPUT_WHO_TO_GREET="Local Dev"
export INPUT_INCLUDE_TIME="true"
export INPUT_MESSAGE_PREFIX="Hey"
node src/index.jsProject Structure
โโโ src/
โ โโโ index.js # Main action code
โโโ __tests__/
โ โโโ index.test.js # Jest tests
โโโ dist/ # Bundled action (generated)
โโโ action.yml # Action metadata
โโโ package.json # Dependencies and scripts
โโโ README.md # This file
On this page
Languages
JavaScript100.0%
MIT License
Created October 8, 2025
Updated March 1, 2026