From 8b6ef85c38bd1a721483b6fc81a4dfe79aceded7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 10 May 2021 15:19:10 +0200 Subject: [PATCH] fix: install dependencies if node_modules is not present --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 055faee6..a5f0b824 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict'; const fs = require('fs').promises; +const { existsSync } = require('fs'); const path = require('path'); const core = require('@actions/core'); @@ -17,6 +18,11 @@ const entry = core.getInput('entry'); ); } + if (!existsSync('node_modules')) { + core.warning('node_modules is not present. Running `npm install`...'); + await exec('npm', ['install']); + } + await exec('node', [ path.join(__dirname, 'node_modules/documentation/bin/documentation.js'), 'build',