tokenHasWorkflowScope checks if the given http.Response's token has the workflow scope. Tokens that do not have OAuth scopes are assumed to have the workflow scope.
(resp *http.Response)
| 299 | // tokenHasWorkflowScope checks if the given http.Response's token has the workflow scope. |
| 300 | // Tokens that do not have OAuth scopes are assumed to have the workflow scope. |
| 301 | func tokenHasWorkflowScope(resp *http.Response) bool { |
| 302 | scopes := resp.Header.Get("X-Oauth-Scopes") |
| 303 | |
| 304 | // Return true when no scopes are present - no scopes in this header |
| 305 | // means that the user is probably authenticating with a token type other |
| 306 | // than an OAuth token, and we don't know what this token's scopes actually are. |
| 307 | if scopes == "" { |
| 308 | return true |
| 309 | } |
| 310 | |
| 311 | return slices.Contains(strings.Split(scopes, ","), "workflow") |
| 312 | } |
| 313 | |
| 314 | // isNewRelease checks if there are new commits since the latest release. |
| 315 | func isNewRelease(httpClient *http.Client, repo ghrepo.Interface) (bool, error) { |
no test coverage detected