-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add policy yaml validation endpoint #142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor comments, but looks good otherwise.
README.md
Outdated
{"message":"failed to parse approval policy: failed to parse subpolicies for 'and': policy references undefined rule 'the devtools team has approved', allowed values: [the devtools team has]","version":"1.12.5"} | ||
``` | ||
|
||
You can combine the HTTP response code to automatically detect failures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can examine the HTTP response code to automatically detect failures
?
server/handler/validate.go
Outdated
requestPolicy, err := ioutil.ReadAll(r.Body) | ||
if err != nil { | ||
check.Message = "Unable to read policy file buffer" | ||
baseapp.WriteJSON(w, http.StatusBadRequest, &check) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be more appropriate as a 500 error? I'm not sure the client did anything wrong here.
❤❤❤ |
It would be really sweet if I could leave a comment on a PR to ask policy bot to do the validation and post back whether it is valid |
One way to resolve #10.
Another approach could also take in the org/repo and current PR to run a more complete validation of all settings, similar to the details endpoint.