We want to improve the GitHub integration by checking the validity of the configuration as early as possible.
Create and use a new API endpoint common for all 4 ALMs POST api/alm_settings/validate?key=xxx
This endpoint will return an empty 200 code if everything is alright, or a 400 code with a message as plaintext detailing what issue is detected.
To validate that GitHub is properly configured, on the endpoint implementation, we want to verify the connectivity, the authentication, and the permissions. Here are the GitHub endpoints to call to achieve that:
- GHE: %s/api/v3
- Github.com: https://api.github.com
- Validate authentication
- validate permissions
- Read permission: /user/repos lists repos of authenticated user
- Write Permission: None
When saving a configuration (be it new or edited), the modal hosting the form will be closed, and validation automatically triggered.
A call is made to api/alm_settings/validate?key=[configuration_key].
The configuration will be shown as "being validated", and then the status will be updated when we get a response.
- In case of success, we show a message and check mark with the status for each feature (PR decoration & import)
- In case of error, the reason ( best effort regarding its precision ) is clearly stated for the user, in order to help them fix whatever the issue is.
This validation can be manually triggered by pressing a button.
When loading the page, all existing configurations are re-validated following the above pattern, with the following exception:
- in case of success, no success message is displayed, only the valid status.
See design for details