diff --git a/.changeset/cuddly-impalas-wave.md b/.changeset/cuddly-impalas-wave.md new file mode 100644 index 0000000000..1199ef1482 --- /dev/null +++ b/.changeset/cuddly-impalas-wave.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +GitHub discovery processor passes over repositories that do not have a default branch diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts index 567f6536d0..8bed5b4858 100644 --- a/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts @@ -108,9 +108,15 @@ export class GithubDiscoveryProcessor implements CatalogProcessor { ); for (const repository of matching) { - const path = `/blob/${ - branch === '-' ? repository.defaultBranchRef.name : branch - }${catalogPath}`; + const branchName = branch === '-' ? repository.defaultBranchRef?.name : branch; + + if (!branchName) { + this.logger.info(`the repository ${repository.url} does not have a default branch, skipping`); + continue; + } + + const path = `/blob/${branchName}${catalogPath}`; + emit( results.location( {