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

GitHub source - Do not error on empty repository #125

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

louisheath
Copy link
Contributor

@louisheath louisheath commented Jun 21, 2024

The Catalog Importer's GitHub "Source" is able to read from all repositories of an organisation, searching each repo's tree for files matching specified file path patterns.

If a repository contains no matching files, no error is thrown. If a repository is empty, it makes sense for the same optimistic behaviour to be followed.

Though GitHub's Response type embeds the HTTP Response, we can't rely on the 409 alone (The API docs describe 409 broadly as "conflict"), so I've opted to string match

Issue #68

if err == nil {
return false
}
return strings.Contains(err.Error(), "409 Git Repository is empty")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda wish we could do something less string-y, but happy with this for now!

@louisheath louisheath merged commit 4c17295 into master Jun 24, 2024
1 check passed
@louisheath louisheath deleted the louis/cat-584-catch-empty-repo branch June 24, 2024 08:40
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