From 3da769f6650283f864fd5dc1a27d77367d92cbd9 Mon Sep 17 00:00:00 2001 From: nrew225 Date: Sat, 10 Dec 2016 07:46:24 -0600 Subject: Initial Commit --- Dangerfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Dangerfile (limited to 'Dangerfile') diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 00000000..8124c31b --- /dev/null +++ b/Dangerfile @@ -0,0 +1,36 @@ +#Check for changes to README.md +has_readme_changes = git.modified_files.include?("README.md") + +# Ensure there is a summary for a pull request +fail 'Please provide a summary in the Pull Request description' if github.pr_body.length < 5 + +# Warn if PR guideline boxes are not checked. +warn 'Please check PR guidelines and check the boxes.' if github.pr_body.include? '- [ ]' + +# Warn if pull request is not updated +warn 'Please update the Pull Request title to contain the script name' if github.pr_title.include? 'Update README.md' + +# Warn when there are merge commits in the diff +warn 'Please rebase to get rid of the merge commits in this Pull Request' if git.commits.any? { |c| c.message =~ /^Merge branch 'master'/ } + +# Check links +if has_readme_changes + require 'json' + results = File.read 'ab-results-temp.md-markdown-table.json' + j = JSON.parse results + if j['error']==true + fail j['title'] + markdown j['message'] + end +end + +# Check syntax +if has_readme_changes + require 'json' + syntaxresults = File.read 'syntaxcheck.json' + sj = JSON.parse syntaxresults + if sj['error']==true + fail sj['title'] + markdown sj['message'] + end +end -- cgit v1.2.3 From 08ef1288a8b798141c6ea3d7de2c7b0efb57482c Mon Sep 17 00:00:00 2001 From: nrew225 Date: Fri, 16 Dec 2016 18:54:22 -0600 Subject: Warn on awesomebot fails --- Dangerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Dangerfile') diff --git a/Dangerfile b/Dangerfile index 8124c31b..bb8fd0e0 100644 --- a/Dangerfile +++ b/Dangerfile @@ -26,11 +26,12 @@ end # Check syntax if has_readme_changes + awesome_bot temp.md --allow-redirect --allow-ssl require 'json' syntaxresults = File.read 'syntaxcheck.json' sj = JSON.parse syntaxresults if sj['error']==true - fail sj['title'] + warn sj['title'] markdown sj['message'] end end -- cgit v1.2.3 From 6b25d7f2a55816cc68d5a7f6c137ddfa34415bd3 Mon Sep 17 00:00:00 2001 From: nrew225 Date: Fri, 16 Dec 2016 19:01:54 -0600 Subject: Warn on awesomebot fails --- Dangerfile | 1 - 1 file changed, 1 deletion(-) (limited to 'Dangerfile') diff --git a/Dangerfile b/Dangerfile index bb8fd0e0..de8e3f2a 100644 --- a/Dangerfile +++ b/Dangerfile @@ -26,7 +26,6 @@ end # Check syntax if has_readme_changes - awesome_bot temp.md --allow-redirect --allow-ssl require 'json' syntaxresults = File.read 'syntaxcheck.json' sj = JSON.parse syntaxresults -- cgit v1.2.3 From e921ece095b765198e87b02a2df1dacc18f3e649 Mon Sep 17 00:00:00 2001 From: nrew225 Date: Fri, 16 Dec 2016 19:27:29 -0600 Subject: warn only on awesomebot fail --- Dangerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Dangerfile') diff --git a/Dangerfile b/Dangerfile index de8e3f2a..86adae6c 100644 --- a/Dangerfile +++ b/Dangerfile @@ -19,7 +19,7 @@ if has_readme_changes results = File.read 'ab-results-temp.md-markdown-table.json' j = JSON.parse results if j['error']==true - fail j['title'] + warn j['title'] markdown j['message'] end end @@ -30,7 +30,7 @@ if has_readme_changes syntaxresults = File.read 'syntaxcheck.json' sj = JSON.parse syntaxresults if sj['error']==true - warn sj['title'] + fail sj['title'] markdown sj['message'] end end -- cgit v1.2.3