Skip to content

Commit

Permalink
Update component when diffs can't be extracted (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrlee authored Jan 6, 2025
1 parent a81adcb commit 7296a71
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions health_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ def update_sc_component(c_id, data):
log.error(f"Error updating component in the SC: {e}")

def git_compare_commits(github_repo, from_sha, to_sha):
repo = gh.get_repo(f'ministryofjustice/{github_repo}')
results = repo.compare(from_sha, to_sha)
comparison = []
for commit in results.commits:
comparison.append({'sha': commit.sha, 'html_url': commit.html_url, 'message': commit.commit.message })
try:
repo = gh.get_repo(f'ministryofjustice/{github_repo}')
results = repo.compare(from_sha, to_sha)
for commit in results.commits:
comparison.append({'sha': commit.sha, 'html_url': commit.html_url, 'message': commit.commit.message })
except Exception as e:
log.error(f"Error retreiving commits for repo: {github_repo} between {from_sha} and {to_sha} : {e}")
return comparison

def update_app_version(app_version, c_name, e_name, github_repo):
Expand Down

0 comments on commit 7296a71

Please sign in to comment.