Skip to content

Commit

Permalink
fix: Catch 404s for non-existing hooks. Fixes #176
Browse files Browse the repository at this point in the history
Explanation: Repositories where no webhooks are defined return 404 errors. This breaks further script execution.
  • Loading branch information
mofe23 committed Jan 16, 2024
1 parent a97f15b commit 42b836f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions github_backup/github_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,11 @@ def backup_hooks(args, repo_cwd, repository, repos_template):
template = "{0}/{1}/hooks".format(repos_template, repository["full_name"])
try:
_backup_data(args, "hooks", template, output_file, hook_cwd)
except SystemExit:
logger.info("Unable to read hooks, skipping")
except Exception as e:
if "404" in str(e):
logger.info("Unable to read hooks, skipping")
else:
raise e


def backup_releases(args, repo_cwd, repository, repos_template, include_assets=False):
Expand Down

0 comments on commit 42b836f

Please sign in to comment.