Skip to content

Commit

Permalink
(#213) queue PR update if status is pending
Browse files Browse the repository at this point in the history
the status is pending if one configured check is still running. If a PR
was just created, the checks haven't passed/failed yet. This wouldn't be
bad IF we would get notifications if they finish. This superseeds
#214
  • Loading branch information
bastelfreak committed Aug 5, 2020
1 parent 41a967e commit 67bc685
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Metrics/ClassLength:
# Offense count: 1
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 10
Max: 11

# Offense count: 15
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
Expand All @@ -40,7 +40,7 @@ Metrics/ParameterLists:
# Offense count: 1
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 8
Max: 9

# Offense count: 2
# Configuration parameters: Include.
Expand Down
4 changes: 2 additions & 2 deletions app/models/pull_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def validate
status_result = validate_status

# If one of the checks is nil perform a new check in one minute
return if mergeable_result && status_result
return if mergeable_result && (!status_result.nil? || status != 'pending')

RefreshPullRequestWorker.perform_in(1.minute.from_now, repository.name, number)
end
Expand All @@ -181,7 +181,7 @@ def validate
# validate() might use update() to change attributes which would trigger a new job
# To prevent loops, we filter `saved_changed` of those attributes and won't create new job if those are the only changed attributes
def queue_validation
force = mergeable.nil? || status.nil?
force = mergeable.nil? || status.nil? || status == 'pending'

case saved_changes.stringify_keys.keys.sort
when %w[eligible_for_merge_comment eligible_for_ci_comment].sort
Expand Down

0 comments on commit 67bc685

Please sign in to comment.