diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-21 01:09:05 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-24 21:29:37 +0200 |
commit | 1d42814166f783766a1b81e926c93c21244289dc (patch) | |
tree | 77379dba611bdfda5dea35d4974489716e40f63c /bridge/github/export.go | |
parent | a121991f556f5b2a362d769b9304956bcedb3805 (diff) | |
download | git-bug-1d42814166f783766a1b81e926c93c21244289dc.tar.gz |
[bridge/github] cache user token
fix import typo
init tests
verify issue
Diffstat (limited to 'bridge/github/export.go')
-rw-r--r-- | bridge/github/export.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bridge/github/export.go b/bridge/github/export.go index 32df8240..e7611360 100644 --- a/bridge/github/export.go +++ b/bridge/github/export.go @@ -21,7 +21,6 @@ import ( // githubImporter implement the Importer interface type githubExporter struct { - gc *githubv4.Client conf core.Configuration // a map containing @@ -45,7 +44,6 @@ type githubExporter struct { func (ge *githubExporter) Init(conf core.Configuration) error { //TODO: initialize with multiple tokens ge.conf = conf - ge.gc = buildClient(conf["token"]) ge.tokens = make(map[string]string) ge.clients = make(map[string]*githubv4.Client) ge.cachedIDs = make(map[string]string) @@ -74,6 +72,8 @@ func (ge *githubExporter) ExportAll(repo *cache.RepoCache, since time.Time) erro return err } + ge.tokens[user.Id()] = ge.conf[keyToken] + // get repository node id ge.repositoryID, err = getRepositoryNodeID( ge.conf[keyOwner], @@ -86,6 +86,7 @@ func (ge *githubExporter) ExportAll(repo *cache.RepoCache, since time.Time) erro } allBugsIds := repo.AllBugsIds() +bugLoop: for _, id := range allBugsIds { b, err := repo.ResolveBug(id) if err != nil { @@ -101,10 +102,14 @@ func (ge *githubExporter) ExportAll(repo *cache.RepoCache, since time.Time) erro // if identity participated in a bug for _, p := range snapshot.Participants { - if p.Id() == user.Id() { - // try to export the bug and it associated events - if err := ge.exportBug(b, user.Identity, since); err != nil { - return err + for userId := range ge.tokens { + if p.Id() == userId { + // try to export the bug and it associated events + if err := ge.exportBug(b, user.Identity, since); err != nil { + return err + } + + continue bugLoop } } } |