Skip to content

AlbertHernandez/github-action-nodejs-template

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Github Actions Logo

⭐ Github Action Template ⭐

Template for new Github Actions based on Typescript with the Best Practices and Ready to be Released

nodejs node supported node typescript swc

👀 Motivation

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.

🌟 What is including this template?

  1. 👷 Use SWC for running the tests of the GitHub Action.
  2. 🐶 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.
  3. 🧪 Testing with Vitest
  4. 📌 Custom path aliases, where you can define your own paths (you will be able to use imports like @src instead of ../../../src).
  5. 🚀 CI/CD using GitHub Actions, helping ensure a good quality of our code and providing useful insights about dependencies, security vulnerabilities and others.
  6. 🥷 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
  7. 👮🏻 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.

🤩 Other templates

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:

👀 Usage

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

💅 Customizing

▶️ Inputs

Key Description Required Default Value
name Name the action will use to say Hello Optional World

◀️ Outputs

Key Description
message Hello world message

😎 Contributing

You're thinking about contributing to this project? Take a look at our contribution guide.