feat: setup Danger
This commit is contained in:
parent
727fcb1951
commit
8a74e7b2a1
4 changed files with 682 additions and 309 deletions
|
@ -38,6 +38,7 @@ script:
|
||||||
else
|
else
|
||||||
yarn build
|
yarn build
|
||||||
fi
|
fi
|
||||||
|
- yarn danger ci
|
||||||
branches:
|
branches:
|
||||||
except:
|
except:
|
||||||
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
||||||
|
|
40
dangerfile.js
Normal file
40
dangerfile.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
import { danger, warn } from 'danger';
|
||||||
|
import eslint from 'danger-plugin-eslint';
|
||||||
|
|
||||||
|
// No PR is too small to include a description of why you made a change
|
||||||
|
if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
|
||||||
|
const title = ':grey_question: No Description';
|
||||||
|
const idea = 'Please include a description of your PR changes.';
|
||||||
|
warn(`${title} - <i>${idea}</i>`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tags big PRs
|
||||||
|
const bigPRThreshold = 600;
|
||||||
|
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
|
||||||
|
const title = ':exclamation: Big PR';
|
||||||
|
const idea = `This PR is extremely unlikely to get reviewed because it touches ${danger.github.pr
|
||||||
|
.additions + danger.github.pr.deletions} lines.`;
|
||||||
|
warn(`${title} - <i>${idea}</i>`);
|
||||||
|
} else if (
|
||||||
|
danger.git.modified_files + danger.git.added_files + danger.git.deleted_files >
|
||||||
|
bigPRThreshold
|
||||||
|
) {
|
||||||
|
const title = ':exclamation: Big PR';
|
||||||
|
const idea = `This PR is extremely unlikely to get reviewed because it touches ${danger.git
|
||||||
|
.modified_files +
|
||||||
|
danger.git.added_files +
|
||||||
|
danger.git.deleted_files} files.`;
|
||||||
|
warn(`${title} - <i>${idea}</i>`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a CHANGELOG entry
|
||||||
|
const hasChangelog = danger.git.modified_files.some(f => f === 'CHANGELOG.md');
|
||||||
|
if (!hasChangelog) {
|
||||||
|
const title = ':page_facing_up: Changelog Entry Missing';
|
||||||
|
const idea = 'Please add a changelog entry for your changes.';
|
||||||
|
warn(`${title} - <i>${idea}</i>`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for ESLint problems
|
||||||
|
eslint();
|
|
@ -84,6 +84,8 @@
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babel-preset-react": "^6.24.1",
|
"babel-preset-react": "^6.24.1",
|
||||||
"babel-preset-stage-2": "^6.18.0",
|
"babel-preset-stage-2": "^6.18.0",
|
||||||
|
"danger": "^3.4.5",
|
||||||
|
"danger-plugin-eslint": "^0.1.0",
|
||||||
"decompress": "^4.2.0",
|
"decompress": "^4.2.0",
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
"devtron": "^1.4.0",
|
"devtron": "^1.4.0",
|
||||||
|
|
Loading…
Reference in a new issue