mirror of
https://github.com/bryanpedini/gitea-mirror.git
synced 2024-11-22 22:12:24 +00:00
debugged github code
This commit is contained in:
parent
079faafb91
commit
5a372a5e49
16
main.go
16
main.go
@ -1,10 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// TODO RUN A GO GET ON THE LIBRARIES BELOW
|
|
||||||
"code.gitea.io/sdk/gitea"
|
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"code.gitea.io/sdk/gitea"
|
||||||
"github.com/google/go-github/github"
|
"github.com/google/go-github/github"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
)
|
)
|
||||||
@ -20,7 +21,7 @@ func main() {
|
|||||||
giteaclient := gitea.NewClient("https://YOURGITEAHOST/", "GETTOKENFROMGITEA") // TODO: CONFIGURE WITH URL of your GITEA INSTANCE AND A TOKEN FROM YOUR GITEA INSTANCE
|
giteaclient := gitea.NewClient("https://YOURGITEAHOST/", "GETTOKENFROMGITEA") // TODO: CONFIGURE WITH URL of your GITEA INSTANCE AND A TOKEN FROM YOUR GITEA INSTANCE
|
||||||
|
|
||||||
opt := &github.RepositoryListByOrgOptions{
|
opt := &github.RepositoryListByOrgOptions{
|
||||||
ListOptions: github.ListOptions{Type: "public", PerPage: 100},
|
ListOptions: github.ListOptions{PerPage: 100},
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all pages of results
|
// get all pages of results
|
||||||
@ -28,7 +29,8 @@ func main() {
|
|||||||
for {
|
for {
|
||||||
repos, resp, err := client.Repositories.ListByOrg(ctx, "PUTGITHUBORGYOUWANTCLONEDHERE", opt) // TODO: SET WITH NAME OF GITHUB ORG YOU WANT CLONED
|
repos, resp, err := client.Repositories.ListByOrg(ctx, "PUTGITHUBORGYOUWANTCLONEDHERE", opt) // TODO: SET WITH NAME OF GITHUB ORG YOU WANT CLONED
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
fmt.Println(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
allRepos = append(allRepos, repos...)
|
allRepos = append(allRepos, repos...)
|
||||||
if resp.NextPage == 0 {
|
if resp.NextPage == 0 {
|
||||||
@ -43,9 +45,9 @@ func main() {
|
|||||||
description = *allRepos[i].Description
|
description = *allRepos[i].Description
|
||||||
}
|
}
|
||||||
giteaclient.MigrateRepo(gitea.MigrateRepoOption{
|
giteaclient.MigrateRepo(gitea.MigrateRepoOption{
|
||||||
CloneAddr: *allRepos[i].CloneURL,
|
CloneAddr: *allRepos[i].CloneURL,
|
||||||
UID: 4, // TODO: SET WITH THE ID OF YOUR USER IN GITEA (IN MY CASE 4 is the user id of an org on my gitea instance)
|
UID: 4, // TODO: SET WITH THE ID OF YOUR USER IN GITEA (IN MY CASE 4 is the user id of an org on my gitea instance)
|
||||||
RepoName: *allRepos[i].Name,
|
RepoName: *allRepos[i].Name,
|
||||||
// Mirror: true, // TODO: uncomment this if you want gitea to periodically check for changes
|
// Mirror: true, // TODO: uncomment this if you want gitea to periodically check for changes
|
||||||
// Private: true, // TODO: uncomment this if you want the repo to be private on gitea
|
// Private: true, // TODO: uncomment this if you want the repo to be private on gitea
|
||||||
Description: description,
|
Description: description,
|
||||||
|
Loading…
Reference in New Issue
Block a user