From 0716974261259c5ed27fef94c6b053f2d8a601b1 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Tue, 16 Jul 2024 18:19:12 -0500 Subject: [PATCH] update --- .gitlab-ci.yml | 26 +++++++++++++++++++ .../gitlab-mirror.ps1 | 9 ++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml rename gitlab-mirror.ps1 => scripts/gitlab-mirror.ps1 (91%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..7e7eb09 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,26 @@ +variables: + script: + description: "Which script to run?" + value: "" + - "" + - "CreateRepos" + + ProjectName: + description: "Name of the Project (For CreateRepos)" + + GITLAB_TOKEN: + description: "Gitlab Token" + + GITHUB_TOKEN: + description: "Github token" + + GITEA_TOKEN: + description: "Gitea Token" + +CreateRepos: + image: mcr.microsoft.com/powershell:latest + script: + - pwsh -f ./scripts/gitlab-mirror.ps1 -ProjectName $ProjectName -GITLAB_TOKEN $GITLAB_TOKEN -GITHUB_TOKEN $GITHUB_TOKEN -GITEA_TOKEN $GITEA_TOKEN + rules: + - if: $script == "CreateRepos" + - when: never diff --git a/gitlab-mirror.ps1 b/scripts/gitlab-mirror.ps1 similarity index 91% rename from gitlab-mirror.ps1 rename to scripts/gitlab-mirror.ps1 index d291709..9763482 100644 --- a/gitlab-mirror.ps1 +++ b/scripts/gitlab-mirror.ps1 @@ -1,4 +1,9 @@ -$ProjectName = Read-Host "What is the name of the project?" +param( + $ProjectName, + $GITLAB_TOKEN, + $GITHUB_TOKEN, + $GITEA_TOKEN +) $gitlabDefaultHeaders = @{ "PRIVATE-TOKEN" = $GITLAB_TOKEN @@ -7,6 +12,7 @@ $gitlabDefaultHeaders = @{ $gitlabBaseURI = "https://gitlab.com/api/v4" #Create Gitlab Repo +Write-Host "Creating Gitlab Repo" $irm = @{ uri = "$gitlabBaseURI/projects" headers = $gitlabDefaultHeaders @@ -21,6 +27,7 @@ $irm = @{ $gitlabProject = Invoke-RestMethod @irm #Create repos in github/gitea and add to gitlab mirror +Write-Host "Creating Github and Gitea Repos" $repos = @( @{ DefaultHeaders = @{