Skip to content

lemonenergy/action-typescript-template

Repository files navigation

Lemon Action Template

Typescript action template with basic setup for GitHub Actions + release.

Setup

  • Format uses Prettier. Setup your editor to format on save with prettier.
  • Lint uses ESLint. Setup your editor to enable eslint flat.
// .vscode/settings.json
{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "always"
  },
  "eslint.useFlatConfig": true
}

Getting started

  • make sure to setup pnpm
  • update package.json with your action name, description, author, license, etc.
  • update action metadata in action.yml
  • add your logic in src/
  • this repo is trunk based, so you can open any PR directly against main branch. On merge, it will be automatically released.
  • typescript is built using unbuild. Check their repository README for details. Extra configuration can be done in unbuild.config.ts as needed.
  • tests are run using vitest. You can add your tests in src/__tests__/. The test command is pnpm test.
  • remember to update the readme as well, so users know how to use your action.

Warning

It might be necessary to make the repository public to use it in GitHub Actions, as private repositories need special permissions that we do not have for now.

Releases

Releases are automatically created when a push is made to main (recommended to be made through pull requests). The release will be tagged and a changelog will be generated based on the commit messages.

Tooling

A few packages are included by default to help with development:

  • tsx - to run typescript files directly (i.e. pnpm tsx src/file.ts)
  • execa - to run shell commands in a cross-platform way (see docs: execa)
  • @actions/core - to interact with GitHub Actions
  • @actions/github - to interact with GitHub API
  • @actions/exec - to run shell commands in GitHub Actions

AI

Claude code config is not included by default, but we recommend you can add it to your project if you want to use AI features with the cli by calling /init.

About

Template for creating custom github actions with typescript support.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors