gh processor passes over repos without default branch

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2021-08-26 22:33:57 +01:00
parent 91ff484f8e
commit 4d62dc15bb
2 changed files with 14 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
GitHub discovery processor passes over repositories that do not have a default branch
@@ -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(
{