Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception handling #2460

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Fix exception handling #2460

merged 2 commits into from
Jan 29, 2025

Conversation

T-Kukawka
Copy link
Contributor

@T-Kukawka T-Kukawka commented Jan 29, 2025

Added handling of Github exception, as it started failing for repos with no changelog while running update-generated-content as:

Repo giantswarm/docs
Getting releases for giantswarm/docs
Traceback (most recent call last):
  File "/workdir/script.py", line 333, in <module>
    changelog = get_changelog_file(g, repo_short)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/script.py", line 56, in get_changelog_file
    remote_file = repo.get_contents('CHANGELOG.md')
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/github/Repository.py", line 2151, in get_contents
    headers, data = self._requester.requestJsonAndCheck(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/github/Requester.py", line 494, in requestJsonAndCheck
    return self.__check(*self.requestJson(verb, url, parameters, headers, input, self.__customConnection(url)))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/github/Requester.py", line 525, in __check
    raise self.createException(status, responseHeaders, data)
github.GithubException.GithubException: 404 {"message": "No object found for the path CHANGELOG.md", "documentation_url": "https://docs.github.com/v3/repos/contents/", "status": "404"}
make: *** [Makefile:25: changes] Error 1

Successful action run: https://github.com/giantswarm/docs/pull/2461/files

@T-Kukawka T-Kukawka requested a review from a team as a code owner January 29, 2025 10:21
Copy link
Contributor

This PR moves/renames or deletes some files. Please make sure to

  • maintain references (also important for images)
  • Maintain aliases in the front matter of moved markdown files

@T-Kukawka T-Kukawka merged commit dbd4fec into main Jan 29, 2025
8 checks passed
@T-Kukawka T-Kukawka deleted the python-rulez branch January 29, 2025 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants