gitea: fix status update for pull requests

This commit is contained in:
Jörg Thalheim 2024-05-27 14:31:35 +02:00
parent af4a31c72f
commit 20c19aca5b
3 changed files with 45 additions and 7 deletions

View file

@ -22,11 +22,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1716660083,
"narHash": "sha256-QO7cdjtDhx72KEw6m0NOtuE5FS4asaRExZ65uFR/q8g=",
"lastModified": 1716792620,
"narHash": "sha256-wQmXzee/veETYJv93TkRYsAQkEdt2QYCJeJil5SrJfg=",
"owner": "Nixos",
"repo": "nixpkgs",
"rev": "6de51d98ec2ae46730f11845e221aab9d2470a8a",
"rev": "7d7cf1590c05d799745bf456f2b95b798f48d3bb",
"type": "github"
},
"original": {

View file

@ -0,0 +1,40 @@
From 6c287ad5735882f71ffa07722f7205eb3bf85269 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Mon, 27 May 2024 14:20:41 +0200
Subject: [PATCH] reporter: create status in the base repository of a pull
requests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Buildbot might not have access to the build status of the fork
and for pull request we want the information in the pull request
window rather than the commit on the fork.
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
buildbot_gitea/reporter.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/buildbot_gitea/reporter.py b/buildbot_gitea/reporter.py
index 85d0a39..27347f2 100644
--- a/buildbot_gitea/reporter.py
+++ b/buildbot_gitea/reporter.py
@@ -164,12 +164,10 @@ def _send_impl(self, reports):
if sha is None:
# No special revision for this, so ignore it
continue
- # If this is a pull request, send the status to the head repository
if 'pr_id' in props:
- repository_name = props['head_reponame']
- repository_owner = props['head_owner']
sha = props['head_sha']
- elif 'repository_name' in props:
+
+ if 'repository_name' in props:
repository_name = props['repository_name']
else:
match = re.match(self.ssh_url_match, sourcestamp['repository'])
--
2.44.1

View file

@ -10,16 +10,14 @@ buildPythonPackage (lib.fix (self: {
pname = "buildbot-gitea";
version = "1.8.0";
nativeBuildInputs = [
];
propagatedBuildInputs = [
pip
buildbot
requests
];
patches = [ ./0001-reporter-create-status-in-the-base-repository-of-a-p.patch ];
src = fetchPypi {
inherit (self) pname version;
hash = "sha256-zYcILPp42QuQyfEIzmYKV9vWf47sBAQI8FOKJlZ60yA=";