hopefully fix it

This commit is contained in:
Charlotte 🦝 Delenk 2022-07-01 07:46:31 +01:00
parent 948acc16db
commit ee829fbebb
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122

View file

@ -12,7 +12,7 @@ index 918bd451..cc1ee7d4 100644
/* When building a flake, use pure evaluation (no access to /* When building a flake, use pure evaluation (no access to
'getEnv', 'currentSystem' etc. */ 'getEnv', 'currentSystem' etc. */
diff --git a/src/lib/Hydra/Plugin/GiteaStatus.pm b/src/lib/Hydra/Plugin/GiteaStatus.pm diff --git a/src/lib/Hydra/Plugin/GiteaStatus.pm b/src/lib/Hydra/Plugin/GiteaStatus.pm
index 426c93f5..26df2345 100644 index 426c93f5..dfacf0a8 100644
--- a/src/lib/Hydra/Plugin/GiteaStatus.pm --- a/src/lib/Hydra/Plugin/GiteaStatus.pm
+++ b/src/lib/Hydra/Plugin/GiteaStatus.pm +++ b/src/lib/Hydra/Plugin/GiteaStatus.pm
@@ -29,6 +29,53 @@ sub toGiteaState { @@ -29,6 +29,53 @@ sub toGiteaState {
@ -39,7 +39,7 @@ index 426c93f5..26df2345 100644
+ $host = $gitea_url->value; + $host = $gitea_url->value;
+ } + }
+ +
+ return "$host/api/v1/repos/$repoOwner/$repoName/statuses/$rev"; + return ("$host/api/v1/repos/$repoOwner/$repoName/statuses/$rev", $repoOwner);
+} +}
+sub is_gitea { +sub is_gitea {
+ my ($ua, $hostname) = @_; + my ($ua, $hostname) = @_;
@ -52,7 +52,7 @@ index 426c93f5..26df2345 100644
+sub try_gitea_from_repo_url { +sub try_gitea_from_repo_url {
+ my ($ua, $url) = @_; + my ($ua, $url) = @_;
+ if ($url =~ m!git\+https://([^/]+)/([^/]+)/([^/]+)\?.*rev=([[:xdigit:]]{40})$!) { + if ($url =~ m!git\+https://([^/]+)/([^/]+)/([^/]+)\?.*rev=([[:xdigit:]]{40})$!) {
+ return "https://$1/api/v1/repos/$2/$3/statuses/$4" if is_gitea($ua, $1); + return ("https://$1/api/v1/repos/$2/$3/statuses/$4", $2) if is_gitea($ua, $1);
+ } + }
+ return undef; + return undef;
+} +}
@ -93,9 +93,9 @@ index 426c93f5..26df2345 100644
- } - }
- -
- my $url = "$host/api/v1/repos/$repoOwner/$repoName/statuses/$rev"; - my $url = "$host/api/v1/repos/$repoOwner/$repoName/statuses/$rev";
+ my $url = url_from_jobsetevalinputs($eval); + my ($url, $repoOwner) = url_from_jobsetevalinputs($eval);
+ if (! defined $url) { + if (! defined $url) {
+ $url = try_gitea($ua, $eval); + ($url, $repoOwner) = try_gitea($ua, $eval);
+ } + }
+ next unless defined $url; + next unless defined $url;
+ my $accessToken = $self->{config}->{gitea_authorization}->{$repoOwner}; + my $accessToken = $self->{config}->{gitea_authorization}->{$repoOwner};