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)
| 289 | // tokenHasWorkflowScope checks if the given http.Response's token has the workflow scope. |
| 290 | // Tokens that do not have OAuth scopes are assumed to have the workflow scope. |
| 291 | func tokenHasWorkflowScope(resp *http.Response) bool { |
| 292 | scopes := resp.Header.Get("X-Oauth-Scopes") |
| 293 | |
| 294 | // Return true when no scopes are present - no scopes in this header |
| 295 | // means that the user is probably authenticating with a token type other |
| 296 | // than an OAuth token, and we don't know what this token's scopes actually are. |
| 297 | if scopes == "" { |
| 298 | return true |
| 299 | } |
| 300 | |
| 301 | return slices.Contains(strings.Split(scopes, ","), "workflow") |
| 302 | } |
| 303 | |
| 304 | // isNewRelease checks if there are new commits since the latest release. |
| 305 | func isNewRelease(httpClient *http.Client, repo ghrepo.Interface) (bool, error) { |
no test coverage detected