Template for new Github Actions based on Typescript with the Best Practices and Ready to be Released
Starting a new github action with NodeJS can be a bit frustrating, there are a lot of things to consider if we want to have a really good starting point where later we can iterate.
The main objective of this template is to provide a good base configuration for our NodeJS Github Actions that we can start using.
- 👷 Use SWC for running the tests of the GitHub Action.
- 🐶 Integration with husky to ensure we have good quality and conventions while we are developing like:
- 💅 Running the linter over the files that have been changed
- 💬 Use conventional commits to ensure our commits have a convention.
- ✅ Run the tests automatically.
- ⚙️ Check our action does not have type errors with Typescript.
- 🙊 Check typos to ensure we don't have grammar mistakes.
- 🧪 Testing with Vitest
- 📌 Custom path aliases, where you can define your own paths (you will be able to use imports like
@/src
instead of../../../src
). - 🚀 CI/CD using GitHub Actions, helping ensure a good quality of our code and providing useful insights about dependencies, security vulnerabilities and others.
- 🥷 Fully automatized release process. You just need to merge into
main
branch using conventional commits and that's all. Automatically we will:- 📍 Create the tags associated to your change
- 📝 Update the changelog
- 📦 Create a release
- 👮🏻 Detection of mismatch of the
dist
folder. Also, it will suggest automatic and manual ways of fixing it via IssueOps approach. Click here to see an example. - 🐦🔥 Use of ESModules instead of CommonJS, which is the standard in JavaScript.
- 📦 Use of pnpm as package manager, which is faster and more efficient than npm or yarn.
Are you thinking in start some new service in the NodeJS ecosystem? If you like this template there are others base on this you can check:
- Template for new Typescript Express Services
- Template for new NestJS Services
- Template for new Typescript Libraries
Bellow is a simple example how to use this action
name: github-action-nodejs-template
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛬
uses: actions/checkout@v4
- name: Github action template 🤩
uses: AlbertHernandez/github-action-nodejs-template@v0
name | description | required | default |
---|---|---|---|
name |
Name the action will use to say Hello. |
false |
World |
name | description |
---|---|
message |
Hello world message |
You're thinking about contributing to this project? Take a look at our contribution guide.