Skip to content

Instantly share code, notes, and snippets.

@toidv
Created November 19, 2018 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toidv/1f871283ee29181b3c6a371e647eb988 to your computer and use it in GitHub Desktop.
Save toidv/1f871283ee29181b3c6a371e647eb988 to your computer and use it in GitHub Desktop.
# Warn when there is not milestone.
has_milestone = github.pr_json["milestone"] != nil
warn("This PR does not refer to an existing milestone", sticky: false) unless has_milestone
# Warn when there is a big PR
warn("This PR is too big. You should divide this PR into smaller PRs.") if git.lines_of_code > 500
# Warn when there is not Github issue.
has_github_issue_in_pr_title = github.pr_title.match /(#\d+)/
has_github_issue_in_pr_body = github.pr_body.match /(#\d+)/
if !declared_trivial && !declared_feature
if has_github_issue_in_pr_title
github_issue_number_title = has_github_issue_in_pr_title[1].match /(\d+)/
message("Github Issue: <a href='https://github.com/Innovatube/android-boilerplate/issues/#{github_issue_number_title[1]}'>https://github.com/Innovatube/android-boilerplate/issues/#{github_issue_number_title[1]}</a>")
elsif has_github_issue_in_pr_body
github_issue_number_body = has_github_issue_in_pr_body[1].match /(\d+)/
message("Github Issue: <a href='https://github.com/Innovatube/android-boilerplate/issues/#{github_issue_number_body[1]}'>https://github.com/Innovatube/android-boilerplate/issues/#{github_issue_number_body[1]}</a>")
else
warn("The Github's issue number not found. Please write Github's issue number on this PR title or body. ")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment