mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Verify SHA in Shippable change detection.
This commit is contained in:
@@ -71,7 +71,7 @@ class ShippableChanges(object):
|
||||
self.paths = sorted(git.get_diff_names([self.branch]))
|
||||
else:
|
||||
merge_runs = self.get_merge_runs(self.project_id, self.branch)
|
||||
last_successful_commit = self.get_last_successful_commit(merge_runs)
|
||||
last_successful_commit = self.get_last_successful_commit(git, merge_runs)
|
||||
|
||||
if last_successful_commit:
|
||||
self.paths = sorted(git.get_diff_names([last_successful_commit, self.commit]))
|
||||
@@ -96,8 +96,9 @@ class ShippableChanges(object):
|
||||
return response.json()
|
||||
|
||||
@staticmethod
|
||||
def get_last_successful_commit(merge_runs):
|
||||
def get_last_successful_commit(git, merge_runs):
|
||||
"""
|
||||
:type git: Git
|
||||
:type merge_runs: dict | list[dict]
|
||||
:rtype: str
|
||||
"""
|
||||
@@ -114,7 +115,8 @@ class ShippableChanges(object):
|
||||
if commit_sha not in known_commits:
|
||||
known_commits.add(commit_sha)
|
||||
if merge_run['statusCode'] == 30:
|
||||
last_successful_commit = commit_sha
|
||||
if git.is_valid_ref(commit_sha):
|
||||
last_successful_commit = commit_sha
|
||||
|
||||
return last_successful_commit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user