This is a ready to use Typescript template for create Github Actions.
This template includes compilation support, tests, a validation workflow, publishing, and versioning.
It's based on actions/typescript-action with some tweaks.
- Uses
pnpm
as package manager; - Uses
eslint
andprettier
with minimal configuration; - Up to date dependencies;
- Simpler build configuration;
- Easy to customize composable workflow;
- Automatic release workflow;
Click the Use this Template
and provide the new repo details for your action.
Make sure you have nodejs
and pnpm
installed on your machine.
Install the dependencies
pnpm install
Build the typescript and package it for distribution
pnpm build
Run the tests ✅:
$ pnpm test
PASS ./wait.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)
The action.yml defines the inputs and output for your action.
Update the action.yml with your name, description, inputs and outputs for your action.
See the documentation
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
import * as core from '@actions/core';
...
async function run() {
try {
...
}
catch (error) {
core.setFailed(error.message);
}
}
See the toolkit documentation for the various packages.
Push code to main
triggers a continuous integration pipeline that will take care of validate the source code, generate build artifacts and a new release based on the commits.
It's recommended to follow conventional commits guidelines to have a meaningfully commit history and to take advantage of semantic-release automatic versioning.