From a04c04f968fb30437981bb93d06ccf0e1d328fac Mon Sep 17 00:00:00 2001 From: n8225 Date: Sun, 4 Dec 2016 09:28:11 -0600 Subject: [PATCH 1/5] Update Dangerfile --- Dangerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dangerfile b/Dangerfile index 73789df7..10320f21 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,6 +1,9 @@ # 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 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'/ } From 2baa3cff6f8581f834a3d88337b2588d03a05f6e Mon Sep 17 00:00:00 2001 From: n8225 Date: Sun, 4 Dec 2016 09:34:56 -0600 Subject: [PATCH 2/5] Update Dangerfile --- Dangerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 10320f21..0b3d23e1 100644 --- a/Dangerfile +++ b/Dangerfile @@ -15,8 +15,9 @@ j = JSON.parse results if j['error']==true fail j['title'] markdown j['message'] +end -# Check syntx +# Check syntax require 'json' results = File.read 'syntaxcheck.json' j = JSON.parse results From f606bfb5587913571855e65278fe8a07f4a907a4 Mon Sep 17 00:00:00 2001 From: n8225 Date: Sun, 4 Dec 2016 09:45:28 -0600 Subject: [PATCH 3/5] Update Dangerfile --- Dangerfile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Dangerfile b/Dangerfile index 0b3d23e1..7cedf891 100644 --- a/Dangerfile +++ b/Dangerfile @@ -9,19 +9,23 @@ warn 'Please update the Pull Request title to contain the script name' if github 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 -require 'json' -results = File.read 'ab-results-README.md-markdown-table.json' -j = JSON.parse results -if j['error']==true +if [ -a ab-results-README.md-markdown-table.json ] + require 'json' + results = File.read 'ab-results-README.md-markdown-table.json' + j = JSON.parse results + if j['error']==true fail j['title'] markdown j['message'] + end end # Check syntax -require 'json' -results = File.read 'syntaxcheck.json' -j = JSON.parse results -if j['error']==true +if [ -a syntaxcheck.json ] + require 'json' + results = File.read 'syntaxcheck.json' + j = JSON.parse results + if j['error']==true fail j['title'] markdown j['message'] -end + end +end From 1fe52b4236d53debce33a4da6a2f6d4a573239ee Mon Sep 17 00:00:00 2001 From: n8225 Date: Sun, 4 Dec 2016 09:57:56 -0600 Subject: [PATCH 4/5] Update Dangerfile --- Dangerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dangerfile b/Dangerfile index 7cedf891..db017b33 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,3 +1,5 @@ +#Check for changes to README.md +has_readme_changes = !git.modified_files.grep(/README.md).empty? # 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 @@ -9,7 +11,7 @@ warn 'Please update the Pull Request title to contain the script name' if github 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 [ -a ab-results-README.md-markdown-table.json ] +if has_readme_changes require 'json' results = File.read 'ab-results-README.md-markdown-table.json' j = JSON.parse results @@ -20,7 +22,7 @@ if [ -a ab-results-README.md-markdown-table.json ] end # Check syntax -if [ -a syntaxcheck.json ] +if has_readme_changes require 'json' results = File.read 'syntaxcheck.json' j = JSON.parse results From eda3a1cfd3ec8eb06f7a9fd353ed631ca13eb111 Mon Sep 17 00:00:00 2001 From: n8225 Date: Sun, 4 Dec 2016 10:05:37 -0600 Subject: [PATCH 5/5] Update Dangerfile --- Dangerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index db017b33..b134a792 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,5 +1,5 @@ #Check for changes to README.md -has_readme_changes = !git.modified_files.grep(/README.md).empty? +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