MCPcopy Create free account
hub / github.com/cli/cli / CheckUploadTarget

Function CheckUploadTarget

pkg/cmd/issue/artifact/shared/shared.go:246–255  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

244// returns the repository ID and permission that attachments.NewUploader
245// checks.
246func 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

Callers 2

TestCheckUploadTargetFunction · 0.85
NewUploaderFunction · 0.85

Calls 2

pullRequestErrorFunction · 0.85
UploadTargetMethod · 0.65

Tested by 1

TestCheckUploadTargetFunction · 0.68