question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors when Github Bot is only installed on some repositories

See original GitHub issue

Expected Behavior

When I install my Github Bot on only some of an organisations repositories. I would like Github Discovery to successfully crawl all repositories that it has access to, without erroring on repositories it doesn’t have access to.

I’d likely do this by telling the Github Credentials Manager to not limit by repositories, as I don’t (think) I need that behaviour.

Current Behavior

GithubAppManager will attempt to create an installation for specific repos, returning the below error.

catalog warn Processor GithubDiscoveryProcessor threw an error while reading github-discovery:https://github.com/{org}/*/blob/master/{custom-file}; caused by HttpError: There is at least one repository that does not exist or is not accessible to the parent installation. type=plugin

Possible Solution

I tested a workaround to this solution by changing the following line to not limit the access token by repository. https://github.com/backstage/backstage/blob/29d616592bd2349d8e9bdd6bb0b1713cd435f8ab/packages/integration/src/github/GithubCredentialsProvider.ts#L107

const repositories = repositorySelection !== 'all'  && repo !== '*' ? [repo!] : undefined;

This worked, but likely isn’t a good idea for everyone. To suggest a solution I’d first need to understand why the access tokens are being created limited by repository, my guess is that’s just not needed for a Github App access but not sure.

Steps to Reproduce

  1. Create a Github App and install it only one some repositories in an organisation

  2. Add The Github App and a Catalog item

integrations:
  github:
    - host: github.com
      apps:
        - $include: github-app-credentials.yaml
catalog:
  locations:
    - type: github-discovery
      target: https://github.com/{ORG}/*/blob/master/app-config.yaml

Context

I’m investigating the use of BackStage and would like to trial it without giving full access to the entire organisation. I’d typically do this by limiting the repositories it has access to.

I’m also going to have rate limiting problems due to the large number of repositories on the org, so whilst testing it can be helpful to limit to a subset of repos, so I can avoid rate limit problems for now.

Your Environment

  • NodeJS Version (v12): v14
  • Operating System and Version (e.g. Ubuntu 14.04): Mac OS

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Rugvipcommented, Aug 8, 2021

I believe @punkle got you covered 😁 #6539, will prolly be part of the next release

0reactions
punklecommented, Aug 12, 2021

You are welcome @jahredhope. Glad to have been able to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Dependabot errors - GitHub Docs
If Dependabot attempts to check whether dependency references need to be updated in a repository, but can't access one or more of the...
Read more >
Troubleshooting cloning errors - GitHub Docs
If you're having trouble cloning a repository, check these common errors.
Read more >
Build error while fetching Python repository #2803 - GitHub
I'm trying to install MediaPipe on Windows through WSL, but I faced some errors while following the steps on the installation page.
Read more >
Error when trying to install package from github repo with ...
Pip is unable to install the package at https://github.com/pyminimp3/pyminimp3 . There's a permission error while cloning its submodule. Judging by Host key ...
Read more >
`fatal: unsafe repository (REPO is owned by someone ... - GitHub
This issue seems only happens for workflows based on docker container, workflows directly running on runners is not affected. git config -- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found