feature/docker-action (#11)

Co-authored-by: kjuulh <contact@kjuulh.io>
Reviewed-on: kjuulh/kraken#11
This commit is contained in:
2022-09-18 11:51:22 +02:00
parent 9696270d22
commit 1ff0014ad4
14 changed files with 202 additions and 21 deletions

View File

@@ -2,7 +2,9 @@ package gitproviders
import (
"context"
"errors"
"fmt"
"os"
"sync"
"code.gitea.io/sdk/gitea"
@@ -121,7 +123,15 @@ func (g *Gitea) getOrCreateClient(ctx context.Context, server string) (*gitea.Cl
client, ok := g.giteaClients[server]
if !ok || client == nil {
c, err := gitea.NewClient(server)
c.SetBasicAuth("kjuulh", "c0bd801cc9a7f2ed559ea45d603afc92f5443f19")
username, ok := os.LookupEnv("GITEA_USERNAME")
if !ok {
return nil, errors.New("missing environment variable GITEA_USERNAME")
}
apitoken, ok := os.LookupEnv("GITEA_API_TOKEN")
if !ok {
return nil, errors.New("missing environment variable GITEA_API_TOKEN")
}
c.SetBasicAuth(username, apitoken)
if err != nil {
return nil, err
}