Creating a Github action for a Node.js 14+ project

Currently it is not possible to create a JavaScript action with a version of nodejs other than 12.

First if you don’t know the basics of Github Actions I recommend you go read the Starting Guide.

A workaround to have a version of nodejs > 12 is to create a Docker container action with the node:16-alpine image.


# See for more information about the action.yml syntax
name: 'My Action'
description: 'What it does..'
description: 'Your name'
required: true
using: 'docker'
image: 'Dockerfile'


# This Dockerfile is inspired from the official document see
FROM node:16-alpine # you can the version of your liking see for more information
COPY github-action-src /github/github-action-src # we need our Github action source files to be available inside the container so let's copy them to "/github/github-action-src" for now.

#!/bin/sh -l

# let's create a specific folder for the source files of our github action

mkdir github-action-src # "github/github-action-src" is the folder we put our Github Action source files into using our Dockerfile
cp -r /github/github-action-src . # now let's copy that folder into the folder for the entire repository "/github/workspace"

# as we are currently inside the github workspace (/github/workspace) containing the source files of the entire repository
# we will need to cd into the folder we previously created "github-action-src"
# you could also copy build files and such to "github-action-src" if you need to
cd github-action-src

npm install
node index.js

If you have any question please send me a mail at