Skip to content

Commit

Permalink
Merge pull request #38 from codfish/pre-commit-validate
Browse files Browse the repository at this point in the history
fix: only run validate pre-commit if script exists
  • Loading branch information
codfish authored Feb 17, 2020
2 parents 4cb3105 + 398138c commit 7b40938
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1

- uses: actions/setup-node@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
node: [10.x, 11.x, 12.x]

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1

- uses: actions/setup-node@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/pre-commit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const spawn = require('cross-spawn');
const { hasPkgProp, hasFile, resolveBin } = require('../utils');
const { hasPkgProp, hasFile, ifScript, resolveBin } = require('../utils');

const here = p => path.join(__dirname, p);
const hereRelative = p => here(p).replace(process.cwd(), '.');
Expand All @@ -19,7 +19,7 @@ const lintStagedResult = spawn.sync(resolveBin('lint-staged'), [...config, ...ar
stdio: 'inherit',
});

if (lintStagedResult.status === 0) {
if (lintStagedResult.status === 0 && ifScript('validate', true)) {
const validateResult = spawn.sync('npm', ['run', 'validate'], {
stdio: 'inherit',
});
Expand Down

0 comments on commit 7b40938

Please sign in to comment.