Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
get source id from source (#72)
Browse files Browse the repository at this point in the history
Signed-off-by: Ayman <[email protected]>
Co-authored-by: Ayman <[email protected]>
  • Loading branch information
khalifapro and enkhalifapro authored Feb 13, 2023
1 parent 3c3ba57 commit 964ab1d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -6129,6 +6129,11 @@ func (j *DSGitHub) Sync(ctx *shared.Ctx, category string) (err error) {
if ctx.DateTo != nil {
j.log.WithFields(logrus.Fields{"operation": "Sync"}).Infof("%s fetching till %v (%d threads)", j.Endpoint(), ctx.DateTo, j.ThrN)
}
sourceID, err := j.gitRepoSourceID()
if err != nil {
return err
}
j.SourceID = sourceID
// NOTE: Non-generic starts here
err = j.SyncCurrentCategory(ctx)
if err != nil {
Expand Down Expand Up @@ -9264,6 +9269,16 @@ func (j *DSGitHub) updateRemoteCache(cacheFile string, cacheType string) error {
return nil
}

func (j *DSGitHub) gitRepoSourceID() (string, error) {
client := j.Clients[j.Hint]
repo, _, err := client.Repositories.Get(j.Context, j.Org, j.Repo)
if err != nil {
return "", err
}
id := strconv.FormatInt(*repo.ID, 10)
return id, nil
}

func isChildKeyCreated(element []ItemCache, id string) bool {
for _, el := range element {
if el.EntityID == id {
Expand Down

0 comments on commit 964ab1d

Please sign in to comment.