roadie-backstage-plugins
roadie-backstage-plugins copied to clipboard
Github token and scope not being requested/add correctly to the GH request for the read me file
Expected Behavior
- For public github.com repositories, the request for the readme file should not add the GH token to the Authorization header if the token is for a GitHub Enterprise instance.
- For internal/private repositories, if the user doesn’t have the required scope (repo), the GH login page should be prompt so the user can authorize access to the new scope.
Current Behavior
- For public github.com repositories, the request for the readme file is always embedding the GH token even if the token is for an enterprise instance, which can provoke an error response
Bad Credentials
( example:https://api.github.com/repos/boozallen/sdp-libraries/readme
) - For internal/private repositories, if the user doesn’t have the required scope, the card shows the message:
Not found
and does not prompt the user to log in to update the scope.
Steps to Reproduce
-
Login to backstage using GitHub enterprise credentials
-
Given an entity located in a public repository in GitHub (github.com), add the Readme card to that entity’s page.
-
Go to the page: it shows the Readme card with the error: Bad credentials.
-
Login to backstage using the GitHub credentials and configure the scope to only
read:user
-
Go to an entity page that has the Readme card configured: it shows the card with the error:
Not Found
. -
If you go to the same page, now adding the repo scope to the X-Oauth-Scopes header, the card is shown correctly:
Possible Solution
Context
We are using the GH Insights Roadie plugin to display the Readme file for several entities (components, systems, domains, templates) to encourage our users to go to the docs and find more information.
Your Environment
-
@backstage/plugin-catalog-react
version: ^1.8.3 -
@backstage/integration
version: ^1.6.2 -
@roadiehq/backstage-plugin-github-insights
version: ^2.3.20
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
unstale please
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
unstale please
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
unstale please
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
unstale please
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
unstale please