-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelete_gh.go
43 lines (35 loc) · 1 KB
/
delete_gh.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package gontentful
import (
"context"
"path/filepath"
gh "github.com/moonwalker/moonbase/pkg/github"
)
type GHDelete struct {
FolderName string
FileName string
SysID string
Locales []*Locale
}
func NewGHDelete(sys *Sys, filaName string, locales *Locales) *GHDelete {
folderName := ""
if sys.Type == DELETED_ENTRY {
folderName = sys.ContentType.Sys.ID
} else if sys.Type == DELETED_ASSET {
folderName = ASSET_TABLE_NAME
}
return &GHDelete{
FolderName: folderName,
SysID: sys.ID,
FileName: filaName,
Locales: locales.Items,
}
}
func (s *GHDelete) Exec(repo string) ([]gh.BlobEntry, error) {
ctx := context.Background()
cfg := getConfig(ctx, owner, repo, branch)
path := filepath.Join(cfg.WorkDir, s.FolderName)
//_, err := gh.DeleteFiles(ctx, cfg.Token, owner, repo, branch, path, "feat(content): delete files", fileNames)
//return err
items, err := gh.GetDeleteFileEntries(ctx, cfg.Token, owner, repo, branch, path, "feat(content): delete files")
return items, err
}