Skip to content

Commit

Permalink
chore(docs site): use git commit message for netlify build (#4900)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev committed Jan 24, 2018
1 parent 673c231 commit ddfaf14
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1,066 deletions.
12 changes: 4 additions & 8 deletions build/netlify-docs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
const sh = require('shelljs');
const semver = require('semver');

const GIT_CONTAINS = `git tag --contains ${process.env.COMMIT_REF}`;
const output = sh.exec(GIT_CONTAINS, {async: false, silent:true}).stdout;

console.log('CONTAINS command:', GIT_CONTAINS);
console.log('BRANCH:', process.env.BRANCH);
console.log('OUTPUT', output);

const GIT_LOG = `git log --format=%B -n 1 ${process.env.COMMIT_REF}`;
const output = sh.exec(GIT_LOG, {async: false, silent:true}).stdout;

// if we're on master branch and not on a tagged commit,
// error the build so it doesn't redeploy the docs
if (process.env.BRANCH === 'master' && output === '') {
if (process.env.BRANCH === 'master' && semver.valid(output.trim()) === null) {
process.exit(1);

// if we're on any other branch, we can regenerate docs
Expand Down
Loading

0 comments on commit ddfaf14

Please sign in to comment.