Skip to content

Commit

Permalink
Merge pull request nf-core#2458 from mashehu/add-retry-functionality
Browse files Browse the repository at this point in the history
switch to safe_get for github requests
  • Loading branch information
mashehu authored Oct 24, 2023
2 parents 3475626 + 0809c17 commit 1a9d973
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concurrency:

env:
NXF_ANSI_LOG: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
RunTestWorkflow:
Expand Down
4 changes: 3 additions & 1 deletion nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ def __call__(self, r):
if os.environ.get("GITHUB_TOKEN") is not None and self.auth is None:
self.auth_mode = "Bearer token with GITHUB_TOKEN"
self.auth = BearerAuth(os.environ["GITHUB_TOKEN"])
else:
log.warning("Could not find GitHub authentication token. Some API requests may fail.")

log.debug(f"Using GitHub auth: {self.auth_mode}")

Expand Down Expand Up @@ -833,7 +835,7 @@ def prompt_remote_pipeline_name(wfs):
# Non nf-core repo on GitHub
if pipeline.count("/") == 1:
try:
gh_api.get(f"https://api.github.com/repos/{pipeline}")
gh_api.safe_get(f"https://api.github.com/repos/{pipeline}")
except Exception:
# No repo found - pass and raise error at the end
pass
Expand Down

0 comments on commit 1a9d973

Please sign in to comment.