From d028258f2305f01b618284df3035fc2329a39620 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 18 Apr 2025 11:42:26 +0300 Subject: [PATCH 1/5] Github__requester is now a public attribute See: https://github.com/PyGithub/PyGithub/pull/3056 --- tcms_github_app/tests/test_github_interfaces.py | 6 +++--- tcms_github_app/utils.py | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tcms_github_app/tests/test_github_interfaces.py b/tcms_github_app/tests/test_github_interfaces.py index 80eab21..b77f964 100644 --- a/tcms_github_app/tests/test_github_interfaces.py +++ b/tcms_github_app/tests/test_github_interfaces.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Alexander Todorov +# Copyright (c) 2023-2025 Alexander Todorov # # Licensed under GNU Affero General Public License v3 or later (AGPLv3+) # https://www.gnu.org/licenses/agpl-3.0.html @@ -25,7 +25,7 @@ def test_utils_PatchedGithub_and_upstream_Github_should_have_the_same_signature( def test_instantiate_an_object_from_utils_PatchedGithub_class(self): inst = utils.PatchedGithub(auth=github.Auth.Token("testing-token")) - self.assertIsNotNone(inst._Github__requester) # pylint: disable=no-member + self.assertIsNotNone(inst.requester) inst = github.Github(auth=github.Auth.Token("testing-token")) - self.assertIsNotNone(inst._Github__requester) + self.assertIsNotNone(inst.requester) diff --git a/tcms_github_app/utils.py b/tcms_github_app/utils.py index b3b8559..65d24cd 100644 --- a/tcms_github_app/utils.py +++ b/tcms_github_app/utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2024 Alexander Todorov +# Copyright (c) 2019-2025 Alexander Todorov # # Licensed under GNU Affero General Public License v3 or later (AGPLv3+) # https://www.gnu.org/licenses/agpl-3.0.html @@ -35,11 +35,8 @@ def get_installation(self, inst_id): Doesn't look like it will be introduced again: https://github.com/PyGithub/PyGithub/issues/1776 """ - # b/c this is self.__requester in the parent class - requester = self._Github__requester # pylint: disable=protected-access,no-member - return github.Installation.Installation( - requester, headers={}, attributes={"id": inst_id}, completed=True + self.requester, headers={}, attributes={"id": inst_id}, completed=True ) From 6ed625e72a3cb95138a1663d34c19d6b57ee797f Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 18 Apr 2025 11:47:52 +0300 Subject: [PATCH 2/5] Remove argument in call to github.Installation.Installation() class `completed` was removed in https://github.com/PyGithub/PyGithub/pull/2746 Fixes KIWI-TCMS-V7, https://kiwitcms.sentry.io/issues/6548382981/ --- tcms_github_app/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcms_github_app/utils.py b/tcms_github_app/utils.py index 65d24cd..a7a6e83 100644 --- a/tcms_github_app/utils.py +++ b/tcms_github_app/utils.py @@ -36,7 +36,7 @@ def get_installation(self, inst_id): https://github.com/PyGithub/PyGithub/issues/1776 """ return github.Installation.Installation( - self.requester, headers={}, attributes={"id": inst_id}, completed=True + self.requester, headers={}, attributes={"id": inst_id} ) From a58fc8f4af11632f544d110fe1efdd61ebfeb3c8 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 18 Apr 2025 12:01:49 +0300 Subject: [PATCH 3/5] Start testing using upstream Postgres container --- .github/workflows/testing.yml | 2 -- docker-compose.yml | 11 ++++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3e0f3a0..ba9da10 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -42,8 +42,6 @@ jobs: pip install -r devel.txt pip install $(curl --silent https://raw.githubusercontent.com/kiwitcms/Kiwi/master/requirements/base.txt | grep PyGithub) - docker exec -i postgresql_database psql -c "ALTER USER kiwi CREATEDB;" - - name: Execute tests env: KIWI_GITHUB_APP_ID: ${{ secrets.KIWI_GITHUB_APP_ID }} diff --git a/docker-compose.yml b/docker-compose.yml index 0285788..8b42c02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,15 +3,16 @@ version: '2' services: db: container_name: postgresql_database - image: centos/postgresql-12-centos7 + image: postgres:latest volumes: - - postgresql_database_data:/var/lib/pgsql/data + - postgresql_database_data:/var/lib/postgresql/data restart: always ports: - 5432:5432 environment: - POSTGRESQL_DATABASE: test_project - POSTGRESQL_USER: kiwi - POSTGRESQL_PASSWORD: kiwi + POSTGRES_DB: test_project + POSTGRES_USER: kiwi + POSTGRES_PASSWORD: kiwi + volumes: postgresql_database_data: From 303174b1f102834a84194f2286ad798a33cf51f7 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 18 Apr 2025 12:20:16 +0300 Subject: [PATCH 4/5] Enable search for WebhookPayloadAdmin --- tcms_github_app/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcms_github_app/admin.py b/tcms_github_app/admin.py index 21546b5..cc07bf8 100644 --- a/tcms_github_app/admin.py +++ b/tcms_github_app/admin.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2024 Alexander Todorov +# Copyright (c) 2019-2025 Alexander Todorov # # Licensed under GNU Affero General Public License v3 or later (AGPLv3+) # https://www.gnu.org/licenses/agpl-3.0.html @@ -20,6 +20,7 @@ class WebhookPayloadAdmin(admin.ModelAdmin): + search_fields = ('action', 'event', 'sender') list_display = ('pk', 'received_on', 'sender', 'event', 'action') ordering = ['-pk'] From 873742158abfdeed0f215b569a77eb6388af43b5 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 18 Apr 2025 12:22:42 +0300 Subject: [PATCH 5/5] Changelog for v2.1.0 --- README.rst | 9 +++++++++ setup.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index fb902d2..1f83165 100644 --- a/README.rst +++ b/README.rst @@ -107,6 +107,15 @@ Then configure how the application interacts with GitHub: Changelog --------- +v2.1.0 (18 Apr 2025) +~~~~~~~~~~~~~~~~~~~~ + +- Refactor internal calls to PyGithub b/c of updated interface. Fixes + `Sentry KIWI-TCMS-V7 `_ +- Enable search for WebhookPayloadAdmin +- Start testing using upstream Postgres + + v2.0.1 (18 Jun 2024) ~~~~~~~~~~~~~~~~~~~~ diff --git a/setup.py b/setup.py index 17308d8..76419f6 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_install_requires(path): setup( name='kiwitcms-github-app', - version='2.0.1', + version='2.1.0', description='GitHub App integration for Kiwi TCMS', long_description=get_long_description(), author='Kiwi TCMS',