feat(alerting): Implement GitHub alerting provider

This commit is contained in:
TwiN
2022-12-15 23:32:04 -05:00
parent 27502acd10
commit ecc0636a59
179 changed files with 57217 additions and 11 deletions

View File

@ -0,0 +1,49 @@
// Copyright 2022 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"fmt"
)
// EnableLFS turns the LFS (Large File Storage) feature ON for the selected repo.
//
// GitHub API docs: https://docs.github.com/en/rest/repos/lfs#enable-git-lfs-for-a-repository
func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo)
req, err := s.client.NewRequest("PUT", u, nil)
if err != nil {
return nil, err
}
resp, err := s.client.Do(ctx, req, nil)
if err != nil {
return resp, err
}
return resp, nil
}
// DisableLFS turns the LFS (Large File Storage) feature OFF for the selected repo.
//
// GitHub API docs: https://docs.github.com/en/rest/repos/lfs#disable-git-lfs-for-a-repository
func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}
resp, err := s.client.Do(ctx, req, nil)
if err != nil {
return resp, err
}
return resp, nil
}