-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore changelog entry request if PR declared #trivial
- Loading branch information
Showing
1 changed file
with
10 additions
and
9 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
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")) |