dependabotErrMsg enhances error messages for dependabot API failures by appending a hint about token permissions when the response indicates the token may lack access to the repository (403 or 404).
(base, owner, repo string, resp *github.Response)
| 217 | // appending a hint about token permissions when the response indicates |
| 218 | // the token may lack access to the repository (403 or 404). |
| 219 | func dependabotErrMsg(base, owner, repo string, resp *github.Response) string { |
| 220 | if resp != nil && (resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusNotFound) { |
| 221 | return fmt.Sprintf("%s. Your token may not have access to Dependabot alerts on %s/%s. "+ |
| 222 | "To access Dependabot alerts, the token needs the 'security_events' scope or, for fine-grained tokens, "+ |
| 223 | "Dependabot alerts read permission for this specific repository.", |
| 224 | base, owner, repo) |
| 225 | } |
| 226 | return base |
| 227 | } |
no outgoing calls
no test coverage detected