Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmcmu committed Jul 9, 2024
1 parent 6e4fe1c commit 8e58b5f
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions .github/workflows/JirabotMerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,20 @@ jobs:
curMajor += 1
for fixVersion in fixVersions:
alreadyHasFixVersion = False
versions = jira.get_project_versions(projectName)
for v in versions:
if v['name'] == fixVersion:
alreadyHasFixVersion = True
if not alreadyHasFixVersion:
project = jira.get_project(projectName)
projectId = project['id']
jira.add_version(projectName, projectId, fixVersion)
try:
alreadyHasFixVersion = False
versions = jira.get_project_versions(projectName)
for v in versions:
if v['name'] == fixVersion:
alreadyHasFixVersion = True
if not alreadyHasFixVersion:
project = jira.get_project(projectName)
projectId = project['id']
jira.add_version(projectName, projectId, fixVersion)
catch Exception as error:
print('Error: Unable to add fix version: ' + fixVersion + ' with: ' + str(error))
sys.exit(1)
return fixVersions
Expand Down Expand Up @@ -180,15 +184,21 @@ jobs:
result += "Error: Unable to find fix version: " + fixVersionName + "\n"
if len(versionsToAdd) > 0:
jira.update_issue_field(issueName, {'fixVersions': updatedVersionList})
try:
jira.update_issue_field(issueName, {'fixVersions': updatedVersionList})
except Exception as error:
result += 'Error: Updating fix versions failed with: "' + str(error) + '\n'
else:
result += "Fix versions already added.\n"
statusName = str(issueFields['status']['name'])
if statusName != 'Resolved':
transitionId = jira.get_transition_id_to_status_name(issue_name, 'Resolved')
jira.set_issue_status_by_transition_id(issue_name, transitionId)
result += "Workflow Transition: 'Resolve issue'\n"
try:
transitionId = jira.get_transition_id_to_status_name(issueName, 'Resolved')
jira.set_issue_status_by_transition_id(issueName, transitionId)
result += "Workflow Transition: 'Resolve issue'\n"
except Exception as error:
result += 'Error: Transitioning to: "Resolved" failed with: "' + str(error) + '\n'
return result
Expand Down Expand Up @@ -219,7 +229,7 @@ jobs:
result = 'Jirabot Action Result:\n'
fixVersions = generateFixVersionList(jira, branch_name)
fixVersions = generateFixVersionList(jira, project_name, branch_name)
result += resolveIssue(jira, issue, fixVersions)
jira.issue_add_comment(issue_name, result)
Expand Down

0 comments on commit 8e58b5f

Please sign in to comment.