From 65db2fd785c077183aff4e8a963318e72f379d45 Mon Sep 17 00:00:00 2001 From: Emir Karamehmetoglu Date: Wed, 7 May 2025 00:11:37 +0200 Subject: [PATCH 1/3] Add pypi environment for publish job Change-Id: I7f936779de65ad59e1125abfab4d7c0086d5538f --- .github/workflows/cd.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index b4d19bf..b20d00f 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -90,6 +90,10 @@ jobs: publish: needs: check runs-on: ubuntu-latest + environment: + name: pypi + # optionally, point to the URL of the deployed package: + url: https://pypi.org/project/adaptive-cards-python/ steps: - uses: actions/checkout@v4 with: From 65e446fcbc9da890f7a2a395586b9210fba8e9a5 Mon Sep 17 00:00:00 2001 From: Emir Karamehmetoglu Date: Wed, 7 May 2025 00:20:04 +0200 Subject: [PATCH 2/3] Format and lint with ruff Change-Id: Idc7bbc87e27d38a5ec5c7b623536a3bc4fb22f24 --- adaptive_cards_python/__init__.py | 2 +- adaptive_cards_python/adaptive_card/AdaptiveCard.py | 1 - adaptive_cards_python/adaptive_card/Extendable.py | 1 - tests/test_validation.py | 8 +++----- tests/test_version.py | 5 ++++- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/adaptive_cards_python/__init__.py b/adaptive_cards_python/__init__.py index 299630e..8be8a67 100644 --- a/adaptive_cards_python/__init__.py +++ b/adaptive_cards_python/__init__.py @@ -18,5 +18,5 @@ "post_to_webhook", "create_payload", "Payload", - "__version__" + "__version__", ] diff --git a/adaptive_cards_python/adaptive_card/AdaptiveCard.py b/adaptive_cards_python/adaptive_card/AdaptiveCard.py index 64b90ee..599c2b8 100644 --- a/adaptive_cards_python/adaptive_card/AdaptiveCard.py +++ b/adaptive_cards_python/adaptive_card/AdaptiveCard.py @@ -237,7 +237,6 @@ def to_json(self) -> str: return self.model_dump_json(exclude_none=True) - class Refresh(ConfiguredBaseModel): """ Defines how a card can be refreshed by making a request to the target Bot. diff --git a/adaptive_cards_python/adaptive_card/Extendable.py b/adaptive_cards_python/adaptive_card/Extendable.py index fef4ec5..ea9dab5 100644 --- a/adaptive_cards_python/adaptive_card/Extendable.py +++ b/adaptive_cards_python/adaptive_card/Extendable.py @@ -1,6 +1,5 @@ from __future__ import annotations # Required to defer type hint evaluation! -from typing import Any from pydantic import BaseModel, ConfigDict, Field from pydantic.alias_generators import to_camel diff --git a/tests/test_validation.py b/tests/test_validation.py index dae4852..188eca9 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -117,13 +117,11 @@ def test_construct_card(): ) ) - card = AdaptiveCard( - type="AdaptiveCard", version="1.5", body=body, actions=actions_list - ) + AdaptiveCard(type="AdaptiveCard", version="1.5", body=body, actions=actions_list) def contruct_from_dict(): - updatable_card = AdaptiveCard.model_validate( + AdaptiveCard.model_validate( { "type": "AdaptiveCard", "version": "1.5", @@ -193,4 +191,4 @@ def test_construct_from_json_string(): ] } """ - approvable_card = AdaptiveCard.model_validate_json(card_json) + AdaptiveCard.model_validate_json(card_json) diff --git a/tests/test_version.py b/tests/test_version.py index abd57f7..2fbccf2 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,10 +1,13 @@ """Check that basic version functionality works""" + from adaptive_cards_python import __version__ as package_version + def test_package_version(): assert package_version != "" assert isinstance(package_version, str) - assert package_version.count(".")==2 + assert package_version.count(".") == 2 + if __name__ == "__main__": test_package_version() From 7f5083a8993f25817c63069ce87aacf48d2b446b Mon Sep 17 00:00:00 2001 From: Emir Karamehmetoglu Date: Wed, 7 May 2025 00:35:38 +0200 Subject: [PATCH 3/3] Fix codeQL alert Change-Id: If5398451519c3ce8e73f965513e5149077bea0ff --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4731cc8..92130d6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,6 +3,10 @@ name: ci on: pull_request: +permissions: + contents: read + pull-requests: write + jobs: test: runs-on: ubuntu-latest