aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/github')
-rw-r--r--bridge/github/config.go2
-rw-r--r--bridge/github/export.go5
-rw-r--r--bridge/github/export_test.go3
-rw-r--r--bridge/github/import_test.go5
4 files changed, 13 insertions, 2 deletions
diff --git a/bridge/github/config.go b/bridge/github/config.go
index 9ede72d4..ed32f398 100644
--- a/bridge/github/config.go
+++ b/bridge/github/config.go
@@ -316,7 +316,7 @@ func promptToken() (string, error) {
fmt.Println(" - 'repo' : to be able to read private repositories")
fmt.Println()
- re, err := regexp.Compile(`^[a-zA-Z0-9]{40}`)
+ re, err := regexp.Compile(`^[a-zA-Z0-9]{40}$`)
if err != nil {
panic("regexp compile:" + err.Error())
}
diff --git a/bridge/github/export.go b/bridge/github/export.go
index 663361f5..1e27be4a 100644
--- a/bridge/github/export.go
+++ b/bridge/github/export.go
@@ -99,7 +99,7 @@ func (ge *githubExporter) cacheAllClient(repo *cache.RepoCache) error {
for _, cred := range creds {
login, ok := cred.GetMetadata(auth.MetaKeyLogin)
if !ok {
- _, _ = fmt.Fprintf(os.Stderr, "credential %s is not tagged with Github login\n", cred.ID().Human())
+ _, _ = fmt.Fprintf(os.Stderr, "credential %s is not tagged with a Github login\n", cred.ID().Human())
continue
}
@@ -107,6 +107,9 @@ func (ge *githubExporter) cacheAllClient(repo *cache.RepoCache) error {
if err == identity.ErrIdentityNotExist {
continue
}
+ if err != nil {
+ return nil
+ }
if _, ok := ge.identityClient[user.Id()]; !ok {
client := buildClient(creds[0].(*auth.Token))
diff --git a/bridge/github/export_test.go b/bridge/github/export_test.go
index d2cfb1f9..cb6bacc1 100644
--- a/bridge/github/export_test.go
+++ b/bridge/github/export_test.go
@@ -144,8 +144,10 @@ func TestPushPull(t *testing.T) {
require.NoError(t, err)
// set author identity
+ login := "identity-test"
author, err := backend.NewIdentity("test identity", "test@test.org")
require.NoError(t, err)
+ author.SetMetadata(metaKeyGithubLogin, login)
err = backend.SetUserIdentity(author)
require.NoError(t, err)
@@ -177,6 +179,7 @@ func TestPushPull(t *testing.T) {
})
token := auth.NewToken(envToken, target)
+ token.SetMetadata(metaKeyGithubLogin, login)
err = auth.Store(repo, token)
require.NoError(t, err)
diff --git a/bridge/github/import_test.go b/bridge/github/import_test.go
index 75310ab3..73eaa096 100644
--- a/bridge/github/import_test.go
+++ b/bridge/github/import_test.go
@@ -21,6 +21,7 @@ import (
func Test_Importer(t *testing.T) {
author := identity.NewIdentity("Michael Muré", "batolettre@gmail.com")
+
tests := []struct {
name string
url string
@@ -140,7 +141,11 @@ func Test_Importer(t *testing.T) {
t.Skip("Env var GITHUB_TOKEN_PRIVATE missing")
}
+ login := "test-identity"
+ author.SetMetadata(metaKeyGithubLogin, login)
+
token := auth.NewToken(envToken, target)
+ token.SetMetadata(metaKeyGithubLogin, login)
err = auth.Store(repo, token)
require.NoError(t, err)