Mirror of Awesome Self Hosted
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. # Danger CI configuration file
  2. # https://danger.systems/guides/getting_started.html
  3. # Check for changes to README.md
  4. has_readme_changes = git.modified_files.include?("README.md")
  5. # Ensure there is a summary for a pull request
  6. fail 'Please provide a summary in the Pull Request description' if github.pr_body.length < 5
  7. # Warn if PR guideline boxes are not checked.
  8. warn 'Please check PR guidelines and check the boxes.' if github.pr_body.include? '- [ ]'
  9. # Warn if pull request is not updated
  10. warn 'Please provide a descriptive title for the Pull Request' if github.pr_title.include? 'Update README.md'
  11. # Warn when there are merge commits in the diff
  12. warn 'Please rebase to get rid of the merge commits in this Pull Request' if git.commits.any? { |c| c.message =~ /^Merge branch 'master'/ }
  13. # Check links
  14. if has_readme_changes
  15. require 'json'
  16. results = File.read 'ab-results-temp.md-markdown-table.json'
  17. j = JSON.parse results
  18. if j['error']==true
  19. warn j['title']
  20. markdown j['message']
  21. end
  22. end
  23. # Check syntax
  24. if has_readme_changes
  25. require 'json'
  26. syntaxresults = File.read 'syntaxcheck.json'
  27. sj = JSON.parse syntaxresults
  28. if sj['error']==true
  29. fail sj['title']
  30. markdown sj['message']
  31. end
  32. end