Skip to content

Commit

Permalink
Ignore changelog entry request if PR declared #trivial
Browse files Browse the repository at this point in the history
  • Loading branch information
macklinu committed Jan 5, 2017
1 parent 6e3519e commit 57a5016
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// import { danger, warn } from "danger"
import fs from "fs"

// Request a CHANGELOG entry
// Request a CHANGELOG entry if not declared #trivial
const hasChangelog = danger.git.modified_files.includes("changelog.md")
if (!hasChangelog) { warn("Please add a changelog entry for your changes.") }
const isTrivial = (danger.github.pr.body + danger.github.pr.title).includes("#trivial")
if (!hasChangelog && !isTrivial) {
warn("Please add a changelog entry for your changes.")

// Politely ask for their name on the entry too
const changelogDiff = danger.git.diffForFile("changelog.md")
const contributorName = danger.github.pr.user.login
if (changelogDiff && changelogDiff.indexOf(contributorName) === -1) {
warn("Please add your GitHub name to the changelog entry, so we can attribute you.")
// Politely ask for their name on the entry too
const changelogDiff = danger.git.diffForFile("changelog.md")
const contributorName = danger.github.pr.user.login
if (changelogDiff && changelogDiff.indexOf(contributorName) === -1) {
warn("Please add your GitHub name to the changelog entry, so we can attribute you.")
}
}

const jsFiles = danger.git.created_files.filter(path => path.endsWith("js"))

0 comments on commit 57a5016

Please sign in to comment.