Pass repositoryId to getOwnerName() for org-owned Gitea repos

Without it, Gitea's adapter can't identify the owner via installationId
(unused for Gitea) and falls back to the authenticated token's own
username -- correct for a personal repo, wrong for an organization-owned
one the user has push access to but doesn't personally own.

GitHub's adapter explicitly ignores repositoryId (resolves owner via the
App installation itself), so this is a no-op there.
This commit is contained in:
harsh mahajan committed 2026-07-14 15:53:02 +05:30
1 parent 77f25efdd5
commit 9dedf391b1
1 file changed
+3 -3
@@ -147,7 +147,7 @@ trait Deployment
$activate = true;
}
$owner = $vcs->getOwnerName($providerInstallationId);
$owner = $vcs->getOwnerName($providerInstallationId, (int) $providerRepositoryId);
try {
$repositoryName = $vcs->getRepositoryName($providerRepositoryId);
} catch (RepositoryNotFound $e) {
@@ -334,7 +334,7 @@ trait Deployment
} catch (RepositoryNotFound $e) {
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
}
$owner = $vcs->getOwnerName($providerInstallationId);
$owner = $vcs->getOwnerName($providerInstallationId, (int) $providerRepositoryId);
$vcs->updateCommitStatus($repositoryName, $providerCommitHash, $owner, 'pending', $message, $authorizeUrl, $name);
continue;
}
@@ -566,7 +566,7 @@ trait Deployment
} catch (RepositoryNotFound $e) {
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
}
$owner = $vcs->getOwnerName($providerInstallationId);
$owner = $vcs->getOwnerName($providerInstallationId, (int) $providerRepositoryId);
$providerTargetUrl = $protocol . '://' . $hostname . "/console/project-$region-$projectId/$resourceCollection/$resourceType-$resourceId";
$vcs->updateCommitStatus($repositoryName, $providerCommitHash, $owner, 'pending', $message, $providerTargetUrl, $name);