MCPcopy Create free account
hub / github.com/google/go-github / AddAutolink

Method AddAutolink

github/repos_autolinks.go:57–70  ·  view source on GitHub ↗

AddAutolink creates an autolink reference for a repository. Users with admin access to the repository can create an autolink. GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#create-an-autolink-reference-for-a-repository meta:operation POST /repos/{owner}/{repo}/

(ctx context.Context, owner, repo string, opts *AutolinkOptions)

Source from the content-addressed store, hash-verified

55//
56//meta:operation POST /repos/{owner}/{repo}/autolinks
57func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) {
58 u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo)
59 req, err := s.client.NewRequest(ctx, "POST", u, opts)
60 if err != nil {
61 return nil, nil, err
62 }
63
64 var al *Autolink
65 resp, err := s.client.Do(req, &al)
66 if err != nil {
67 return nil, resp, err
68 }
69 return al, resp, nil
70}
71
72// GetAutolink returns a single autolink reference by ID that was configured for the given repository.
73// Information about autolinks are only available to repository administrators.

Callers 2

Calls 2

NewRequestMethod · 0.80
DoMethod · 0.45

Tested by 2