Skip to content

Commit

Permalink
fix: install dependencies if node_modules is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 10, 2021
1 parent 25d349f commit 8b6ef85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const fs = require('fs').promises;
const { existsSync } = require('fs');
const path = require('path');

const core = require('@actions/core');
Expand All @@ -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',
Expand Down

0 comments on commit 8b6ef85

Please sign in to comment.