checkUploadTokenType rejects a credential that cannot upload. It is an allowlist, so an unlisted kind is rejected rather than sent.
(tokenType gh.TokenType)
| 78 | // checkUploadTokenType rejects a credential that cannot upload. It is an |
| 79 | // allowlist, so an unlisted kind is rejected rather than sent. |
| 80 | func checkUploadTokenType(tokenType gh.TokenType) error { |
| 81 | if slices.Contains(uploadTokenTypes, tokenType) { |
| 82 | return nil |
| 83 | } |
| 84 | return errors.New("unsupported authentication type") |
| 85 | } |
| 86 | |
| 87 | // uploadPermissions lists the repository permissions that can attach a file. |
| 88 | // The list matches api.Repository.ViewerCanPush, and it is measured against the |