Skip to content

Commit

Permalink
Sync - handle existing PR
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed Jul 31, 2020
1 parent d17af2b commit 1ce1746
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Apologies for the inconvenience.
* Fix syntax error in `/push_dockerhub.yml` GitHub Action workflow
* Change `params.readPaths` -> `params.input_paths` in `test_full.config`
* Check results when posting the lint results as a GitHub comment
* Change `params.readPaths` -> `params.input_paths` in `test_full.config`

## [v1.10.1 - Copper Camel _(patch)_](https://github.com/nf-core/tools/releases/tag/1.10.1) - [2020-07-30]

Expand Down
15 changes: 11 additions & 4 deletions nf_core/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,20 @@ def make_pull_request(self):
self.gh_pr_returned_data = r.content
returned_data_prettyprint = r.content

if r.status_code != 201:
# PR worked
if r.status_code == 201:
log.debug("GitHub API PR worked:\n{}".format(returned_data_prettyprint))
log.info("GitHub PR created: {}".format(self.gh_pr_returned_data["html_url"]))

# We already had a PR open
elif r.status_code == 422:
log.warn("GitHub PR is already open!")

# Something went wrong
else:
raise PullRequestException(
"GitHub API returned code {}: \n{}".format(r.status_code, returned_data_prettyprint)
)
else:
log.debug("GitHub API PR worked:\n{}".format(returned_data_prettyprint))
log.info("GitHub PR created: {}".format(self.gh_pr_returned_data["html_url"]))

def reset_target_dir(self):
"""
Expand Down

0 comments on commit 1ce1746

Please sign in to comment.