-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.7.0 - Adding dangerfile to run PR checks (#8)
- Loading branch information
1 parent
e113248
commit 7da5062
Showing
5 changed files
with
1,540 additions
and
791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.