klesh opened a new issue, #4712: URL: https://github.com/apache/incubator-devlake/issues/4712
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar feature requirement. ### Use case As a user, when setting up Apache DevLake connection, I need a specific warning message when my token has limited access. ### Description With @jakezhu9 's great implementation from #4686, we notice that Github has [multiple levels of access for a PAT](https://devlake.apache.org/docs/next/Configuration/GitHub#github-personal-access-tokensrecommended). - For public repos, #4686 is sufficient for the case. - For private repos, we also need extra permissions in order to do so. However, it is hard to tell what is the intention when the connection is being tested. The reasonable way to solve the problem would be to prompt users about the extra permission and why they are needed for users to decide wisely. ## Solution For Github, when public repos checking is OK, but NOT private repos, the BE should output sth like the following ``` 200 OK { "success": true, "warning": true, "message": "`repo` is also required if you need to collect data from private repositories", "login", "whomai" } ``` when token has all possible public/private permission we need, the API should output sth like the following: 200 OK { "success": true, "warning": false, "message": "success", "login", "whomai" } ``` if token has none of the permission we need: 400 OK { "success": false, "warning": false, "message": "`repo:status`, `repo_deployment`, `read:user`, `read:org` are required, `repo` is required for collecting data from private repositories", "login", "whomai" } ``` The general idea is to add `warning` flag to indicate if the given `PAT` is limited, and detail would be described by the good old `message` field. The idea applies to other plugins as well and should be fine-tuned according to their API specification. ## Todo - Github - Jira - Gitlab - Bitbucket ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
