#8 delete cobra, add parsing .netrc
This commit is contained in:
@@ -59,6 +59,10 @@ type giteaPull struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
func (g *Gitea) Name() string {
|
||||
return "gitea"
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestOpen start, mod title: %s", path))
|
||||
|
||||
@@ -256,7 +260,7 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
||||
req, err := http.NewRequestWithContext(
|
||||
ctx,
|
||||
http.MethodPost,
|
||||
fmt.Sprintf("%s/repos/%s/%s/pulls?token=%s", g.URL, g.Owner, g.Repository, g.Token),
|
||||
fmt.Sprintf("https://%s/api/v1/repos/%s/%s/pulls?token=%s", g.URL, g.Owner, g.Repository, g.Token),
|
||||
bytes.NewReader(buf),
|
||||
)
|
||||
if err != nil {
|
||||
@@ -371,6 +375,9 @@ func (g *Gitea) RequestList(ctx context.Context, branch string) (map[string]stri
|
||||
rMap := make(map[string]string)
|
||||
|
||||
for _, pull := range gPulls {
|
||||
if !strings.HasPrefix(pull.Title, "Bump ") { //добавляем только реквесты бота по обновлению модулей
|
||||
continue
|
||||
}
|
||||
path = strings.Split(pull.Title, " ")[1] //todo Работет только для дефолтного шаблона
|
||||
rMap[path] = pull.Title
|
||||
}
|
||||
@@ -388,7 +395,7 @@ func getVersions(s string) string {
|
||||
|
||||
func DeleteBranch(ctx context.Context, url, owner, repo, branch, token string) (*http.Request, error) {
|
||||
var buf []byte
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, fmt.Sprintf("%s/repos/%s/%s/branches/%s?token=%s", url, owner, repo, branch, token), bytes.NewReader(buf))
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, fmt.Sprintf("https://%s/api/v1/repos/%s/%s/branches/%s?token=%s", url, owner, repo, branch, token), bytes.NewReader(buf))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -404,7 +411,7 @@ func GetPulls(ctx context.Context, url, owner, repo, token string) ([]*giteaPull
|
||||
req, err := http.NewRequestWithContext(
|
||||
ctx,
|
||||
http.MethodGet,
|
||||
fmt.Sprintf("%s/repos/%s/%s/pulls?state=open&token=%s", url, owner, repo, token),
|
||||
fmt.Sprintf("https://%s/api/v1//repos/%s/%s/pulls?state=open&token=%s", url, owner, repo, token),
|
||||
nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user