AlbertHernandez / github-action-nodejs-template

Template for new Github Actions based on Typescript with the Best Practices and Ready to be Released
github.com/AlbertHernandez/github-action-nodejs-template
MIT License
11 stars 1 forks source link
github-action-nodejs-template nodejs template typescript typescript-library

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.
    • ๐Ÿ™Š Check typos to ensure we don't have grammar mistakes.
  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.
  8. ๐Ÿฆโ€๐Ÿ”ฅ Use of ESModules instead of CommonJS, which is the standard in JavaScript.

๐Ÿคฉ 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

Inputs

name description required default
name

Name the action will use to say Hello.

false World

Outputs

name description
message

Hello world message

๐Ÿ˜Ž Contributing

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