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

Commit 964ab1d

Browse files
get source id from source (#72)
Signed-off-by: Ayman <[email protected]> Co-authored-by: Ayman <[email protected]>
1 parent 3c3ba57 commit 964ab1d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cmd/github/github.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6129,6 +6129,11 @@ func (j *DSGitHub) Sync(ctx *shared.Ctx, category string) (err error) {
61296129
if ctx.DateTo != nil {
61306130
j.log.WithFields(logrus.Fields{"operation": "Sync"}).Infof("%s fetching till %v (%d threads)", j.Endpoint(), ctx.DateTo, j.ThrN)
61316131
}
6132+
sourceID, err := j.gitRepoSourceID()
6133+
if err != nil {
6134+
return err
6135+
}
6136+
j.SourceID = sourceID
61326137
// NOTE: Non-generic starts here
61336138
err = j.SyncCurrentCategory(ctx)
61346139
if err != nil {
@@ -9264,6 +9269,16 @@ func (j *DSGitHub) updateRemoteCache(cacheFile string, cacheType string) error {
92649269
return nil
92659270
}
92669271

9272+
func (j *DSGitHub) gitRepoSourceID() (string, error) {
9273+
client := j.Clients[j.Hint]
9274+
repo, _, err := client.Repositories.Get(j.Context, j.Org, j.Repo)
9275+
if err != nil {
9276+
return "", err
9277+
}
9278+
id := strconv.FormatInt(*repo.ID, 10)
9279+
return id, nil
9280+
}
9281+
92679282
func isChildKeyCreated(element []ItemCache, id string) bool {
92689283
for _, el := range element {
92699284
if el.EntityID == id {

0 commit comments

Comments
 (0)