CheckUploadTarget is CheckIssue for a command that uploads files with --attach. It refuses a pull request the same way, and its one lookup also returns the repository ID and permission that attachments.NewUploader checks.
(c client.ArtifactClient, repo ghrepo.Interface, number int)
| 244 | // returns the repository ID and permission that attachments.NewUploader |
| 245 | // checks. |
| 246 | func CheckUploadTarget(c client.ArtifactClient, repo ghrepo.Interface, number int) (*client.UploadTarget, error) { |
| 247 | target, err := c.UploadTarget(repo, number) |
| 248 | if err != nil { |
| 249 | return nil, err |
| 250 | } |
| 251 | if target.IsPullRequest { |
| 252 | return nil, pullRequestError(repo, number) |
| 253 | } |
| 254 | return target, nil |
| 255 | } |
| 256 | |
| 257 | // NewUploader returns the uploader for a command's --attach files, which |
| 258 | // upload against the issue's repository with the token for its host. It |