Skip to content

Commit

Permalink
v0.7.0 - Adding dangerfile to run PR checks (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleynolan authored and DamianMullins committed Jan 17, 2018
1 parent e113248 commit 7da5062
Show file tree
Hide file tree
Showing 5 changed files with 1,540 additions and 791 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ node_js:

cache: yarn

sudo: false

notifications:
email: false

script:
- yarn danger ci

after_success:
- yarn run test:coveralls
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


v0.7.0
------------------------------
*January 16, 2018*

### Added
- `dangerfile.js` added to check PRs via Travis

### Changed
- Updated `gulp-build-fozzie` version


v0.6.0
------------------------------
*December 20, 2017*
Expand All @@ -20,7 +31,6 @@ v0.6.0
- Fixed ESlint issues.



v0.5.0
------------------------------
*September 21, 2017*
Expand Down
34 changes: 34 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* global danger, fail, message */

const bodyAndTitle = (danger.github.pr.body + danger.github.pr.title).toLowerCase();
const isTrivial = bodyAndTitle.includes('#trivial');

if (!isTrivial) {
// Fail if there isn’t a CHANGELOG entry – should update for every PR
if (!danger.git.modified_files.includes('CHANGELOG.md')) {
const changelogLink = 'https://github.com/justeat/f-toggle/blob/master/CHANGELOG.md';
fail(`:memo: Please include a CHANGELOG entry. You can find the current version at <a href="${changelogLink}">CHANGELOG.md</a>`);
}


// Check for version update
const hasPackageJsonChanged = danger.git.modified_files.includes('package.json');
const packageDiff = danger.git.JSONDiffForFile('package.json');

packageDiff.then(result => {
if (!hasPackageJsonChanged || (hasPackageJsonChanged && !result.version)) {
const semverLink = 'https://docs.npmjs.com/getting-started/semantic-versioning';
/* eslint-disable no-console */console.log('Versioning Missing'); console.log(hasPackageJsonChanged, result);/* eslint-enable no-console */
fail(`:exclamation: This PR should include a <a href="${semverLink}">SEMVER</a> version bump, so that it can be published once merged.`);
}
}, err => {
/* eslint-disable no-console */
console.log(err);
/* eslint-enable no-console */
});

// Message on deletions
if (danger.github.pr.deletions > danger.github.pr.additions) {
message(':fire: :clap: You’re a deletion machine!');
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@justeat/f-toggle",
"description": "Fozzie vanilla JS toggle library.",
"version": "0.6.0",
"version": "0.7.0",
"main": "dist/index.js",
"homepage": "https://github.com/justeat/f-toggle",
"contributors": [
Expand All @@ -23,12 +23,13 @@
"qwery": "^4.0.0"
},
"devDependencies": {
"@justeat/gulp-build-fozzie": "^6.5.0",
"@justeat/gulp-build-fozzie": "^7.0.0",
"babel-cli": "^6.26.0",
"babel-preset-babili": "^0.1.4",
"babel-preset-es2015": "^6.24.1",
"concurrently": "^3.5.1",
"coveralls": "^3.0.0",
"danger": "^3.0.5",
"gulp": "^3.9.1",
"js-test-buddy": "^0.0.7"
},
Expand Down
Loading

0 comments on commit 7da5062

Please sign in to comment.