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',