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.

36 lines
1.1 KiB

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