-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dangerfile.js
35 lines (29 loc) · 1.03 KB
/
dangerfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { danger, markdown, fail, warn, message } = require('danger')
const awesomeBotResults = require('./ab-results-README.md-markdown-table.json')
const githubMetadata = danger.git.fileMatch('.github/**')
const yamlData = danger.git.fileMatch('data/**')
const scripts = danger.git.fileMatch('scripts/**')
const src = danger.git.fileMatch('src/**')
const readme = danger.git.fileMatch('README.md')
if (readme.edited) {
fail('Please do not edit the README directly. It is generated from the data in the data/ directory.')
}
if (githubMetadata.edited) {
message('Changes were made within the .github folder.')
}
if (yamlData.edited) {
message('YAML data files were edited.')
/**
* Only display awesomeBot results if the data yaml used to generate the readme have been modified.
*/
if (awesomeBotResults.error) {
fail(awesomeBotResults.title)
markdown(awesomeBotResults.message)
}
}
if (scripts.edited) {
warn('Changes were made to the scripts folder.')
}
if (src.edited) {
warn('Changes were made to the src folder.')
}