Browse Source

Little script to create a repo from the API in gogs

Simon Watson 2 years ago
parent
commit
258db98d54
1 changed files with 24 additions and 0 deletions
  1. 24 0
      create_repo.pl

+ 24 - 0
create_repo.pl

@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $token = $ARGV[0];
+chomp $token;
+
+my $url = "https://git.spwbk.site/api/v1/";
+
+sub create_repo {
+	my $name = shift;
+
+	my $endpoint = "/user/repos";
+
+	my $curl_string = "curl -H \'Content-Type: application/json\' -X POST -d \'{\"name\": \"$name\", \"description\": \"$name\", \"private\": false}\' https://git.spwbk.site/api/v1/user/repos?token=$token";
+
+	print("$curl_string\n");
+	system($curl_string) == 0 or die "CURL ERROR with $name\n";
+
+}
+
+
+create_repo($ARGV[1]);