migration: transfer the repo ownership
This commit is contained in:
@ -3,15 +3,30 @@
|
||||
# Modules used
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Carp;
|
||||
|
||||
|
||||
my $cmd = "git log --format=format:%H --all";
|
||||
my @output = `$cmd`;
|
||||
chomp @output;
|
||||
my $drone_url="$ENV{'DRONE_SYSTEM_PROTO'}://$ENV{'DRONE_SYSTEM_HOST'}";
|
||||
my $drone_project=$ENV{'DRONE_REPO'};
|
||||
my $drone_api="$drone_url/api/repos/$drone_project/builds";
|
||||
my $gitea_token=$ENV{'GITEA_TOKEN'};
|
||||
my $commits = "git log --format=format:%H --all";
|
||||
my @commits_out = `$commits`;
|
||||
chomp @commits_out;
|
||||
push @commits_out, 'latest';
|
||||
|
||||
foreach my $line (@output)
|
||||
my $builds = "curl -X 'GET' $drone_api -H 'accept: application/json' | jq -r '.[].after'";
|
||||
my @builds_out = `$builds`;
|
||||
chomp @builds_out;
|
||||
|
||||
|
||||
foreach my $line (@builds_out)
|
||||
{
|
||||
print "$line";
|
||||
print $line;
|
||||
if ( ! grep( /^$line$/, @commits_out ) ) {
|
||||
my $cmd = "curl -X 'DELETE' \"https://git.badhouseplants.net/api/v1/packages/badhouseplants/container/badhouseplants-net/${line}\" -H 'accept: application/json' -u allanger:$gitea_token || true";
|
||||
print "Removing ${line}\n";
|
||||
my $output = `$cmd`;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user