From 640e2651301f437873b4d585e43c4dd70743e3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:15:09 +0100 Subject: [PATCH 01/29] =?UTF-8?q?dodanie=20p=C3=B3l:=20email,=20kod=20pacz?= =?UTF-8?q?komatu,=20dodatkowe=20informacje=20dla=20dostawcy;=20dodane=20w?= =?UTF-8?q?i=C4=99cej=20opis=C3=B3w=20i=20informacji=20opisowych=20w=20for?= =?UTF-8?q?mularzu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/nowa.yaml | 39 +++++++++++++++++++++++++++- .github/scripts/consts.py | 4 ++- .github/scripts/organization.yaml.j2 | 4 +++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/nowa.yaml b/.github/ISSUE_TEMPLATE/nowa.yaml index a69e99f..3f64af0 100644 --- a/.github/ISSUE_TEMPLATE/nowa.yaml +++ b/.github/ISSUE_TEMPLATE/nowa.yaml @@ -75,6 +75,10 @@ body: attributes: value: | # Dane teleadresowe do dostaw + + Podaj dane dla dostaw przesyłek do Twojej organizacji. Powinny to być oficjalne dane teleadresowe. + Pamiętaj, że przekazane tutaj informacje będą publicznie dostępne na stronie Twojej organizacji + w Wyślij.co. - type: input id: ulica attributes: @@ -95,16 +99,49 @@ body: label: Miasto validations: required: true + - type: input + id: email + attributes: + label: Adres email dla firmy kurierskiej + description: | + Podaj oficjalny adres email, na który firma kurierska wyśle powiadomienia dotyczące przesyłki. + Pamiętaj, że ten adres będzie publicznie widoczny w internecie. + placeholder: nazwa@example.com + validations: + required: true - type: input id: telefon attributes: label: Telefon kontaktowy dla kuriera - description: Wprowadź numer telefonu w formacie `000 000 000` + description: | + Wprowadź numer telefonu w formacie `000 000 000` + Podaj oficjalny numer telefonu, na który firma kurierska wyśle powiadomienia dotyczące przesyłki. + Pamiętaj, że ten numer będzie publicznie widoczny w internecie. placeholder: 000 000 000 validations: required: true + - type: input + id: kod_paczkomatu + attributes: + label: Kod paczkomatu + description: | + Podaj kod paczkomatu, w którym możesz odebrać przesyłki wysłane za pośrednictwem firmy InPost. + Kod paczkomatu możesz znaleźć na stronie [Znajdź Paczkomat](https://inpost.pl/znajdz-paczkomat). + placeholder: WAW01M + validations: + required: true + - type: textarea + id: dodatkowe_informacje + attributes: + label: Dodatkowe informacje dla dostawcy + description: | + Jeżeli to konieczne, podaj dodatkowe informacje do przekazania dla firmy dostawczej. asd + placeholder: WAW01M + validations: + required: true - type: markdown attributes: value: | # Następne kroki Po wypełnieniu formularza, Twój wniosek zostanie zweryfikowany przez nasz zespół. W celu weryfikacji poprawności danych skontaktujemy się z Twoją organizacją poprzez oficjalne dane kontaktowe dostępne na stronie internetowej organizacji lub w rejestrze KRS. W przypadku pozytywnej weryfikacji, otrzymasz od nas informację o dalszych krokach w komentarzu do tego zgłoszenia (zakładka Issues). + Pamiętaj, że przekazane przez Ciebie dane powinny być informacjami oficjalnymi Twojej organizacji i będą dostępne publicznie w zgłoszeniu, kodzie oraz na stronach Wyślij.co. diff --git a/.github/scripts/consts.py b/.github/scripts/consts.py index b58569e..47764db 100644 --- a/.github/scripts/consts.py +++ b/.github/scripts/consts.py @@ -10,7 +10,9 @@ class OrgFormSchemaIds(enum.StrEnum): postal_code = "kod_pocztowy" city = "miasto" phone_number = "telefon" - + email = "email" + package_box_code = "kod_paczkomatu" + additional_info = "dodatkowe_informacje" NEW_ORG_ISSUE_DEFAULT_TITLE = "[Nowa Organizacja]" NEW_ORG_FORM_SCHEMA_FILENAME = "nowa.yaml" diff --git a/.github/scripts/organization.yaml.j2 b/.github/scripts/organization.yaml.j2 index 6fd42f5..6baa1e2 100644 --- a/.github/scripts/organization.yaml.j2 +++ b/.github/scripts/organization.yaml.j2 @@ -11,6 +11,10 @@ dostawa: kod: {{ organization.postal_code }} miasto: {{ organization.city }} telefon: {{ organization.phone_number }} + email: {{ organization.email }} + kod_paczkomatu: {{ organization.package_box_code }} + dodatkowe_informacje: | + {{ organization.additional_info }} produkty: - nazwa: Testowy produkt From bb3028318a3080e5098acbe2546d74d8875b28a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:28:39 +0100 Subject: [PATCH 02/29] =?UTF-8?q?poprawione=20pola=20wymagane;=20usuni?= =?UTF-8?q?=C4=99cie=20placeholdera?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/nowa.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/nowa.yaml b/.github/ISSUE_TEMPLATE/nowa.yaml index 3f64af0..1b04618 100644 --- a/.github/ISSUE_TEMPLATE/nowa.yaml +++ b/.github/ISSUE_TEMPLATE/nowa.yaml @@ -129,16 +129,15 @@ body: Kod paczkomatu możesz znaleźć na stronie [Znajdź Paczkomat](https://inpost.pl/znajdz-paczkomat). placeholder: WAW01M validations: - required: true + required: false - type: textarea id: dodatkowe_informacje attributes: label: Dodatkowe informacje dla dostawcy description: | - Jeżeli to konieczne, podaj dodatkowe informacje do przekazania dla firmy dostawczej. asd - placeholder: WAW01M + Jeżeli to konieczne, podaj dodatkowe informacje do przekazania dla firmy dostawczej. validations: - required: true + required: false - type: markdown attributes: value: | From 8621fad6f4ae57ee00ca4cecd64f3da2bd6d453a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:29:28 +0100 Subject: [PATCH 03/29] =?UTF-8?q?dodatkowe=20informacje=20jako=20zwyk?= =?UTF-8?q?=C5=82y=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/nowa.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/nowa.yaml b/.github/ISSUE_TEMPLATE/nowa.yaml index 1b04618..8fcbf8f 100644 --- a/.github/ISSUE_TEMPLATE/nowa.yaml +++ b/.github/ISSUE_TEMPLATE/nowa.yaml @@ -130,7 +130,7 @@ body: placeholder: WAW01M validations: required: false - - type: textarea + - type: input id: dodatkowe_informacje attributes: label: Dodatkowe informacje dla dostawcy From 153eb6448652640541d46d5fe4b84055275ed4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:30:36 +0100 Subject: [PATCH 04/29] poprawki formatowania yaml --- .github/ISSUE_TEMPLATE/nowa.yaml | 3 ++- .github/scripts/organization.yaml.j2 | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/nowa.yaml b/.github/ISSUE_TEMPLATE/nowa.yaml index 8fcbf8f..2d3491c 100644 --- a/.github/ISSUE_TEMPLATE/nowa.yaml +++ b/.github/ISSUE_TEMPLATE/nowa.yaml @@ -143,4 +143,5 @@ body: value: | # Następne kroki Po wypełnieniu formularza, Twój wniosek zostanie zweryfikowany przez nasz zespół. W celu weryfikacji poprawności danych skontaktujemy się z Twoją organizacją poprzez oficjalne dane kontaktowe dostępne na stronie internetowej organizacji lub w rejestrze KRS. W przypadku pozytywnej weryfikacji, otrzymasz od nas informację o dalszych krokach w komentarzu do tego zgłoszenia (zakładka Issues). - Pamiętaj, że przekazane przez Ciebie dane powinny być informacjami oficjalnymi Twojej organizacji i będą dostępne publicznie w zgłoszeniu, kodzie oraz na stronach Wyślij.co. + + **Pamiętaj, że przekazane przez Ciebie dane powinny być informacjami oficjalnymi Twojej organizacji i będą dostępne publicznie w zgłoszeniu, kodzie oraz na stronach Wyślij.co.** diff --git a/.github/scripts/organization.yaml.j2 b/.github/scripts/organization.yaml.j2 index 6baa1e2..ba73d27 100644 --- a/.github/scripts/organization.yaml.j2 +++ b/.github/scripts/organization.yaml.j2 @@ -13,8 +13,7 @@ dostawa: telefon: {{ organization.phone_number }} email: {{ organization.email }} kod_paczkomatu: {{ organization.package_box_code }} - dodatkowe_informacje: | - {{ organization.additional_info }} + dodatkowe_informacje: {{ organization.additional_info }} produkty: - nazwa: Testowy produkt From a732dfa4be7b55420c4d76675d1c17cea8452918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:51:06 +0100 Subject: [PATCH 05/29] =?UTF-8?q?dodanie=20walidacji=20plik=C3=B3w=20yaml?= =?UTF-8?q?=20przy=20zmianie=20danych=20organizacji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/organization.yaml.j2 | 2 +- .github/workflows/organization-update.yaml | 24 ++++++++++++++++++++++ organizations/testowa.yaml | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/organization-update.yaml diff --git a/.github/scripts/organization.yaml.j2 b/.github/scripts/organization.yaml.j2 index ba73d27..acbfe96 100644 --- a/.github/scripts/organization.yaml.j2 +++ b/.github/scripts/organization.yaml.j2 @@ -1,3 +1,4 @@ +--- nazwa: {{ organization.name }} # wyslij.co/testowej - adres, pod którym będzie dostępna strona @@ -18,4 +19,3 @@ dostawa: produkty: - nazwa: Testowy produkt link: http://example.com - diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml new file mode 100644 index 0000000..a0807eb --- /dev/null +++ b/.github/workflows/organization-update.yaml @@ -0,0 +1,24 @@ +name: Przetwarzenie zgłoszenia organizacji + +on: + pull_request: + paths: + - 'organizations/**' + + +env: + GITHUB_TOKEN: ${{ github.token }} + +permissions: + contents: read + +jobs: + + yaml-linting: + name: Walidacja pliku organizacji + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ibiqlik/action-yamllint@v3 + with: + file_or_dir: organizations/*.yaml diff --git a/organizations/testowa.yaml b/organizations/testowa.yaml index de1082d..eea8590 100755 --- a/organizations/testowa.yaml +++ b/organizations/testowa.yaml @@ -1,3 +1,4 @@ +--- nazwa: Testowa organizacja # wyslij.co/testowej - adres, pod którym będzie dostępna strona @@ -17,7 +18,6 @@ produkty: link: http://testowy.pl - nazwa: Testowy produkt 2 link: http://testowy2.pl - opis: Opcjonalny opis, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum vestibulum. Cras vehicula, urna sit amet tincidunt tincidunt, neque tellus egestas libero, nec convallis sem sapien ut nulla. + opis: Opcjonalny, krótki opis, Lorem ipsum dolor sit amet. - nazwa: Testowy produkt 3 link: http://testowy3.pl - opis: From 99fa2d47f090d8c740ba0acfc982d58f990f34a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:51:36 +0100 Subject: [PATCH 06/29] =?UTF-8?q?dodanie=20walidacji=20plik=C3=B3w=20yaml?= =?UTF-8?q?=20przy=20zmianie=20danych=20organizacji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/organization-update.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index a0807eb..2a01c03 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -1,4 +1,4 @@ -name: Przetwarzenie zgłoszenia organizacji +name: Walidacja zmian plików organizacji on: pull_request: From 72f323ffee60ac8b2ce94def3e34bb79b9ae4c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:56:02 +0100 Subject: [PATCH 07/29] =?UTF-8?q?dodanie=20brakuj=C4=85cej=20zale=C5=BCno?= =?UTF-8?q?=C5=9Bci=20Jinja2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index dc8b87f..7c5871d 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -3,3 +3,4 @@ PyYAML==6.0.2 requests==2.32.3 GitPython==3.1.43 ruff==0.8.3 +Jinja2==3.1.4 From ee8aaa6b0cc75237388ed9a79b0e4f828a9ebce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 12:57:06 +0100 Subject: [PATCH 08/29] =?UTF-8?q?dodanie=20obs=C5=82ugi=20pustego=20pola?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/parsers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/parsers.py b/.github/scripts/parsers.py index 1bd142d..2c900b0 100644 --- a/.github/scripts/parsers.py +++ b/.github/scripts/parsers.py @@ -27,4 +27,7 @@ def get_label(self, identifier: str) -> str | None: def get(self, identifier: str) -> str | None: label = self.get_label(identifier) - return self.form_data.get(label, "") + value = self.form_data.get(label, "") + if value == "_No response_": + return "" + return value From e3132bc64c12a63214a8bf8075a874f516e521ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:00:38 +0100 Subject: [PATCH 09/29] =?UTF-8?q?obs=C5=82uga=20brakuj=C4=85cego=20brancha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 0eb0d30..31bee8b 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -1,7 +1,7 @@ import logging from dataclasses import dataclass -from github import GithubException, InputGitTreeElement +from github import InputGitTreeElement, UnknownObjectException from github.GitCommit import GitCommit from github.GitRef import GitRef from github.Issue import Issue @@ -12,7 +12,6 @@ from exceptions import BranchModifiedError from parsers import GithubIssueFormDataParser - logger = logging.getLogger(__file__) @@ -42,8 +41,8 @@ def get_or_create_branch(self, source_branch: str, new_branch_name: str) -> GitR try: branch_ref = self.repo.get_git_ref(f"heads/{new_branch_name}") logger.info(f"Found existing branch '{new_branch_name}'.") - except GithubException as e: - if e.status == 404: + except UnknownObjectException as e: + if e.status == "404": # Branch does not exist, create it from the source branch self.repo.create_git_ref( ref=f"refs/heads/{new_branch_name}", sha=source.commit.sha From b9147cbe9032d651d39141b43549873c836b3244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:02:47 +0100 Subject: [PATCH 10/29] =?UTF-8?q?obs=C5=82uga=20brakuj=C4=85cego=20brancha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 31bee8b..8d1ad1c 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -44,10 +44,9 @@ def get_or_create_branch(self, source_branch: str, new_branch_name: str) -> GitR except UnknownObjectException as e: if e.status == "404": # Branch does not exist, create it from the source branch - self.repo.create_git_ref( + branch_ref = self.repo.create_git_ref( ref=f"refs/heads/{new_branch_name}", sha=source.commit.sha ) - branch_ref = self.repo.get_git_ref(f"heads/{new_branch_name}") logger.info( f"Branch '{new_branch_name}' created from '{source_branch}'." ) From 4155647f060a322625e22d0e47a6170d0e98391b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:04:39 +0100 Subject: [PATCH 11/29] =?UTF-8?q?obs=C5=82uga=20brakuj=C4=85cego=20brancha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 8d1ad1c..691d86d 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -41,17 +41,14 @@ def get_or_create_branch(self, source_branch: str, new_branch_name: str) -> GitR try: branch_ref = self.repo.get_git_ref(f"heads/{new_branch_name}") logger.info(f"Found existing branch '{new_branch_name}'.") - except UnknownObjectException as e: - if e.status == "404": - # Branch does not exist, create it from the source branch - branch_ref = self.repo.create_git_ref( - ref=f"refs/heads/{new_branch_name}", sha=source.commit.sha - ) - logger.info( - f"Branch '{new_branch_name}' created from '{source_branch}'." - ) - else: - raise e + except UnknownObjectException: + # Branch does not exist, create it from the source branch + branch_ref = self.repo.create_git_ref( + ref=f"refs/heads/{new_branch_name}", sha=source.commit.sha + ) + logger.info( + f"Branch '{new_branch_name}' created from '{source_branch}'." + ) latest_commit = self.repo.get_commit(branch_ref.object.sha) if ( From af231d205e8d5e0c4a77938ad50679fb8d331ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:09:28 +0100 Subject: [PATCH 12/29] poprawione uprawnienia dla Github Action --- .github/scripts/git_managers.py | 3 ++- .github/workflows/nowa-organizacja.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 691d86d..89f8619 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -1,7 +1,8 @@ import logging from dataclasses import dataclass -from github import InputGitTreeElement, UnknownObjectException +from github import InputGitTreeElement +from github.GithubException import UnknownObjectException from github.GitCommit import GitCommit from github.GitRef import GitRef from github.Issue import Issue diff --git a/.github/workflows/nowa-organizacja.yaml b/.github/workflows/nowa-organizacja.yaml index e43820b..29763a6 100644 --- a/.github/workflows/nowa-organizacja.yaml +++ b/.github/workflows/nowa-organizacja.yaml @@ -9,7 +9,7 @@ env: GITHUB_TOKEN: ${{ github.token }} permissions: - contents: read + contents: write issues: write pull-requests: write From 1e8589a6e00b9b52f63fb0cf38d0ffe01c5911f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:18:57 +0100 Subject: [PATCH 13/29] =?UTF-8?q?dodanie=20trigger=C3=B3w=20dla=20Github?= =?UTF-8?q?=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/organization.yaml.j2 | 1 + .github/workflows/flask-gh-pages.yaml | 10 ++++++++++ .github/workflows/organization-update.yaml | 8 +++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/scripts/organization.yaml.j2 b/.github/scripts/organization.yaml.j2 index acbfe96..c808a5d 100644 --- a/.github/scripts/organization.yaml.j2 +++ b/.github/scripts/organization.yaml.j2 @@ -19,3 +19,4 @@ dostawa: produkty: - nazwa: Testowy produkt link: http://example.com + diff --git a/.github/workflows/flask-gh-pages.yaml b/.github/workflows/flask-gh-pages.yaml index 1cc9f88..8649936 100755 --- a/.github/workflows/flask-gh-pages.yaml +++ b/.github/workflows/flask-gh-pages.yaml @@ -25,8 +25,18 @@ concurrency: cancel-in-progress: false jobs: + yaml-linting: + name: Walidacja plików organizacji + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ibiqlik/action-yamllint@v3 + with: + file_or_dir: organizations/*.yaml + # Build job build: + needs: [yaml-linting] runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index 2a01c03..59c08b5 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -1,10 +1,12 @@ -name: Walidacja zmian plików organizacji +name: Walidacja zmiany plików organizacji on: - pull_request: + push: paths: - 'organizations/**' - + pull_request: + branches: + - main env: GITHUB_TOKEN: ${{ github.token }} From c9968180d5608742beac5e3b2c0aa35bc90a9fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:21:24 +0100 Subject: [PATCH 14/29] =?UTF-8?q?dodanie=20trigger=C3=B3w=20dla=20Github?= =?UTF-8?q?=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/organization-update.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index 59c08b5..e32dc70 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -3,7 +3,7 @@ name: Walidacja zmiany plików organizacji on: push: paths: - - 'organizations/**' + - './organizations/**' pull_request: branches: - main From 741bc65abb0d8e903e9f18debb0ed628e712250f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:37:09 +0100 Subject: [PATCH 15/29] naprawienie kluczy dla schemy yaml --- .github/scripts/renderers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/renderers.py b/.github/scripts/renderers.py index 0b95eec..7d37d6d 100644 --- a/.github/scripts/renderers.py +++ b/.github/scripts/renderers.py @@ -12,6 +12,6 @@ def render_organization_yaml(data: GithubIssueFormDataParser): template = env.get_template("organization.yaml.j2") - org_data = {field: data.get(field) for field in OrgFormSchemaIds} + org_data = {field: data.get(field) for field in OrgFormSchemaIds.__members__.keys()} return template.render(organization=org_data) From 14861862b19f77a4abf381f988edad5a9b92f98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:46:18 +0100 Subject: [PATCH 16/29] =?UTF-8?q?zmiana=20nazewnictwa=20p=C3=B3l=20dla=20u?= =?UTF-8?q?nifikacji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/nowa.yaml | 18 +++++++++--------- .github/scripts/consts.py | 18 +++++++++--------- .github/scripts/parsers.py | 14 ++++++++++---- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/nowa.yaml b/.github/ISSUE_TEMPLATE/nowa.yaml index 2d3491c..9fd81cc 100644 --- a/.github/ISSUE_TEMPLATE/nowa.yaml +++ b/.github/ISSUE_TEMPLATE/nowa.yaml @@ -12,13 +12,13 @@ body: Dziękujemy za zainteresowanie dołączeniem do programu Wyślij.co. Wypełnij poniższe pola informacjami o swojej organizacji, żeby zgłosić ją do programu. # Podstawowe informacje - type: input - id: nazwa + id: name attributes: label: Nazwa Twojej organizacji validations: required: true - type: input - id: www + id: website attributes: label: Adres strony internetowej Twojej organizacji validations: @@ -63,7 +63,7 @@ body: **Uwaga!** Zastrzegamy sobie prawo do zmiany tej wartości w celu zapewnienia równego traktowania wszystkich organizacji korzystających z programu Wyślij.co. - type: input - id: nazwa_strony + id: slug attributes: label: Nazwa Twojej strony w Wyślij.co description: Wprowadź nazwę bez polskich znaków diakrytycznych, oraz spacjami zmienionymi na `-` @@ -80,13 +80,13 @@ body: Pamiętaj, że przekazane tutaj informacje będą publicznie dostępne na stronie Twojej organizacji w Wyślij.co. - type: input - id: ulica + id: street attributes: label: Ulica i numer budynku/lokalu validations: required: true - type: input - id: kod_pocztowy + id: postal_code attributes: label: Kod Pocztowy description: Wprowadź kod pocztowy w formacie `00-000` @@ -94,7 +94,7 @@ body: validations: required: true - type: input - id: miasto + id: city attributes: label: Miasto validations: @@ -110,7 +110,7 @@ body: validations: required: true - type: input - id: telefon + id: phone_number attributes: label: Telefon kontaktowy dla kuriera description: | @@ -121,7 +121,7 @@ body: validations: required: true - type: input - id: kod_paczkomatu + id: package_box_code attributes: label: Kod paczkomatu description: | @@ -131,7 +131,7 @@ body: validations: required: false - type: input - id: dodatkowe_informacje + id: additional_info attributes: label: Dodatkowe informacje dla dostawcy description: | diff --git a/.github/scripts/consts.py b/.github/scripts/consts.py index 47764db..2afc942 100644 --- a/.github/scripts/consts.py +++ b/.github/scripts/consts.py @@ -2,17 +2,17 @@ class OrgFormSchemaIds(enum.StrEnum): - name = "nazwa" - website = "www" + name = "name" + website = "website" krs = "krs" - slug = "nazwa_strony" - street = "ulica" - postal_code = "kod_pocztowy" - city = "miasto" - phone_number = "telefon" + slug = "slug" + street = "street" + postal_code = "postal_code" + city = "city" + phone_number = "phone_number" email = "email" - package_box_code = "kod_paczkomatu" - additional_info = "dodatkowe_informacje" + package_box_code = "package_box_code" + additional_info = "additional_info" NEW_ORG_ISSUE_DEFAULT_TITLE = "[Nowa Organizacja]" NEW_ORG_FORM_SCHEMA_FILENAME = "nowa.yaml" diff --git a/.github/scripts/parsers.py b/.github/scripts/parsers.py index 2c900b0..638edcd 100644 --- a/.github/scripts/parsers.py +++ b/.github/scripts/parsers.py @@ -14,16 +14,22 @@ def __init__(self, form_data: dict[str, Any], form_schema_filename: str): self.form_schema_filename = form_schema_filename self.form_schema = self.get_form_schema(form_schema_filename) + self.field_label_map = self._create_field_label_map() + + def _create_field_label_map(self): + field_label_map = {} + for field in self.form_schema.get("body", []): + if "id" in field: + field_label_map[field["id"]] = field["attributes"]["label"] + return field_label_map + @staticmethod def get_form_schema(template_filename): with open(f"../ISSUE_TEMPLATE/{template_filename}") as f: return yaml.safe_load(f) def get_label(self, identifier: str) -> str | None: - for field in self.form_schema.get("body", []): - if "id" in field and field["id"] == identifier: - return field["attributes"]["label"] - return None + return self.field_label_map.get(identifier) def get(self, identifier: str) -> str | None: label = self.get_label(identifier) From 821ad460cd1248a1785824314210c104433fd513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 13:51:01 +0100 Subject: [PATCH 17/29] refactoring --- .github/scripts/renderers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/renderers.py b/.github/scripts/renderers.py index 7d37d6d..0b95eec 100644 --- a/.github/scripts/renderers.py +++ b/.github/scripts/renderers.py @@ -12,6 +12,6 @@ def render_organization_yaml(data: GithubIssueFormDataParser): template = env.get_template("organization.yaml.j2") - org_data = {field: data.get(field) for field in OrgFormSchemaIds.__members__.keys()} + org_data = {field: data.get(field) for field in OrgFormSchemaIds} return template.render(organization=org_data) From 67580a631e37be5834881774b8013b744a6bda97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:03:10 +0100 Subject: [PATCH 18/29] =?UTF-8?q?zaktualizowane=20wyci=C4=85ganie=20kluczy?= =?UTF-8?q?;=20reformatowanie=20plik=C3=B3w;=20debug=20akcji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/consts.py | 1 + .github/scripts/git_managers.py | 6 ++---- .github/scripts/pullers.py | 2 +- .github/scripts/renderers.py | 5 ++++- .github/workflows/organization-update.yaml | 8 ++++---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/scripts/consts.py b/.github/scripts/consts.py index 2afc942..96b0aba 100644 --- a/.github/scripts/consts.py +++ b/.github/scripts/consts.py @@ -14,6 +14,7 @@ class OrgFormSchemaIds(enum.StrEnum): package_box_code = "package_box_code" additional_info = "additional_info" + NEW_ORG_ISSUE_DEFAULT_TITLE = "[Nowa Organizacja]" NEW_ORG_FORM_SCHEMA_FILENAME = "nowa.yaml" diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 89f8619..ddbe34f 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -47,9 +47,7 @@ def get_or_create_branch(self, source_branch: str, new_branch_name: str) -> GitR branch_ref = self.repo.create_git_ref( ref=f"refs/heads/{new_branch_name}", sha=source.commit.sha ) - logger.info( - f"Branch '{new_branch_name}' created from '{source_branch}'." - ) + logger.info(f"Branch '{new_branch_name}' created from '{source_branch}'.") latest_commit = self.repo.get_commit(branch_ref.object.sha) if ( @@ -124,7 +122,7 @@ def create_organization_yaml_pr( pr_title = f"Dodana nowa organizacja: {data.get(OrgFormSchemaIds.name)} | Zgłoszenie: #{issue.number}" pr_body = f"Automatycznie dodana nowa organizacja na podstawie zgłoszenia z issue #{issue.number}.\n\n Closes #{issue.number}" - file_path = "organizations/organization.yaml" + file_path = f"organizations/{data.get(OrgFormSchemaIds.slug)}.yaml" manager = GitManager(repo) manager.create_or_update_pr_with_file( diff --git a/.github/scripts/pullers.py b/.github/scripts/pullers.py index 452402c..319bd39 100644 --- a/.github/scripts/pullers.py +++ b/.github/scripts/pullers.py @@ -1,4 +1,4 @@ -from typing import Optional, Self +from typing import Self import requests from github import Issue diff --git a/.github/scripts/renderers.py b/.github/scripts/renderers.py index 0b95eec..3b64b81 100644 --- a/.github/scripts/renderers.py +++ b/.github/scripts/renderers.py @@ -12,6 +12,9 @@ def render_organization_yaml(data: GithubIssueFormDataParser): template = env.get_template("organization.yaml.j2") - org_data = {field: data.get(field) for field in OrgFormSchemaIds} + org_data = { + field: data.get(str(OrgFormSchemaIds[field])) + for field in OrgFormSchemaIds.__members__.keys() + } return template.render(organization=org_data) diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index e32dc70..b584af6 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -2,11 +2,7 @@ name: Walidacja zmiany plików organizacji on: push: - paths: - - './organizations/**' pull_request: - branches: - - main env: GITHUB_TOKEN: ${{ github.token }} @@ -21,6 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Show changed files + run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} + - name: Print GitHub Context + run: echo "${{ toJson(github) }}" - uses: ibiqlik/action-yamllint@v3 with: file_or_dir: organizations/*.yaml From 036a2a81fc010a2c05083818de9965e0fe9625d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:04:06 +0100 Subject: [PATCH 19/29] =?UTF-8?q?usuni=C4=99cie=20zb=C4=99dnego=20enva?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/organization-update.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index b584af6..091aedf 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -4,9 +4,6 @@ on: push: pull_request: -env: - GITHUB_TOKEN: ${{ github.token }} - permissions: contents: read From 5fcc7e71e8fa57dee6273953c2ea07d60b1d7ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:06:27 +0100 Subject: [PATCH 20/29] debug github action --- .github/workflows/organization-update.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index 091aedf..1eb0c63 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -14,8 +14,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history to ensure all commits are accessible - name: Show changed files - run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} + run: | + if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then + echo "Initial commit or new branch. Listing all files:" + git ls-files + else + echo "Changed files since previous commit:" + git diff --name-only ${{ github.event.before }} ${{ github.sha }} + fi - name: Print GitHub Context run: echo "${{ toJson(github) }}" - uses: ibiqlik/action-yamllint@v3 From 24988471a40bd44a123e7aae3effbbe804a56f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:30:27 +0100 Subject: [PATCH 21/29] =?UTF-8?q?dodane=20r=C4=99czne=20wywo=C5=82ywanie?= =?UTF-8?q?=20workflow=20dla=20walidacji=20yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 10 +++++++++- .github/workflows/organization-update.yaml | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index ddbe34f..b9267b1 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -2,6 +2,7 @@ from dataclasses import dataclass from github import InputGitTreeElement +from github.Commit import Commit from github.GithubException import UnknownObjectException from github.GitCommit import GitCommit from github.GitRef import GitRef @@ -92,8 +93,14 @@ def create_or_update_remote_branch_with_file_commit( branch, file_path, file_contents, commit_message ) branch.edit(commit.sha) + self.dispatch_workflow(commit) return branch + def dispatch_workflow(self, commit: GitCommit): + github_commit = self.repo.get_commit(commit.sha) + workflow = self.repo.get_workflow("organization-update.yaml") + workflow.create_dispatch(ref=github_commit) + def create_or_update_pr_with_file( self, source_branch: str, @@ -107,7 +114,8 @@ def create_or_update_pr_with_file( self.create_or_update_remote_branch_with_file_commit( source_branch, new_branch, file_path, file_contents, commit_message ) - return self.get_or_create_pr(source_branch, new_branch, pr_title, pr_body) + pr = self.get_or_create_pr(source_branch, new_branch, pr_title, pr_body) + self.dispatch_workflow() def create_organization_yaml_pr( diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index 1eb0c63..24e359d 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -2,7 +2,12 @@ name: Walidacja zmiany plików organizacji on: push: + paths: + - 'organizations/*.yaml' pull_request: + paths: + - 'organizations/*.yaml' + workflow_dispatch: permissions: contents: read From b7bf5c9ca26ef4f9c4aab5904152712968d9692a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:41:53 +0100 Subject: [PATCH 22/29] =?UTF-8?q?debug:=20czy=20run=20si=C4=99=20psuje=20p?= =?UTF-8?q?rzez=20branch/commit=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 3 ++- .github/workflows/nowa-organizacja.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index b9267b1..2554c9d 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -98,8 +98,9 @@ def create_or_update_remote_branch_with_file_commit( def dispatch_workflow(self, commit: GitCommit): github_commit = self.repo.get_commit(commit.sha) + main_branch = self.repo.get_branch("main") workflow = self.repo.get_workflow("organization-update.yaml") - workflow.create_dispatch(ref=github_commit) + workflow.create_dispatch(ref=main_branch) def create_or_update_pr_with_file( self, diff --git a/.github/workflows/nowa-organizacja.yaml b/.github/workflows/nowa-organizacja.yaml index 29763a6..2e0521b 100644 --- a/.github/workflows/nowa-organizacja.yaml +++ b/.github/workflows/nowa-organizacja.yaml @@ -12,6 +12,7 @@ permissions: contents: write issues: write pull-requests: write + workflows: write jobs: From 0f1418852e345eb0aef59595971c1fb6e3fb0acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:43:29 +0100 Subject: [PATCH 23/29] =?UTF-8?q?debug:=20czy=20run=20si=C4=99=20psuje=20p?= =?UTF-8?q?rzez=20branch/commit=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/nowa-organizacja.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/nowa-organizacja.yaml b/.github/workflows/nowa-organizacja.yaml index 2e0521b..fecdf19 100644 --- a/.github/workflows/nowa-organizacja.yaml +++ b/.github/workflows/nowa-organizacja.yaml @@ -12,8 +12,7 @@ permissions: contents: write issues: write pull-requests: write - workflows: write - + jobs: validate-form: From bafa755e8f11c4da4200e7cf52fda78445a32171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:50:31 +0100 Subject: [PATCH 24/29] =?UTF-8?q?debug:=20run=20z=20u=C5=BCyciem=20PAT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/cli.py | 2 +- .github/scripts/git_managers.py | 14 +++++++------- .github/workflows/nowa-organizacja.yaml | 7 ++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/scripts/cli.py b/.github/scripts/cli.py index a7292d4..94a37d3 100644 --- a/.github/scripts/cli.py +++ b/.github/scripts/cli.py @@ -23,7 +23,7 @@ ) logger = logging.getLogger(__file__) -GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") +GITHUB_TOKEN = os.getenv("GITHUB_PAT") GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY") auth = Auth.Token(GITHUB_TOKEN) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 2554c9d..9abcab6 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -93,14 +93,14 @@ def create_or_update_remote_branch_with_file_commit( branch, file_path, file_contents, commit_message ) branch.edit(commit.sha) - self.dispatch_workflow(commit) + # self.dispatch_workflow(commit) return branch - - def dispatch_workflow(self, commit: GitCommit): - github_commit = self.repo.get_commit(commit.sha) - main_branch = self.repo.get_branch("main") - workflow = self.repo.get_workflow("organization-update.yaml") - workflow.create_dispatch(ref=main_branch) + # + # def dispatch_workflow(self, commit: GitCommit): + # github_commit = self.repo.get_commit(commit.sha) + # main_branch = self.repo.get_branch("main") + # workflow = self.repo.get_workflow("organization-update.yaml") + # workflow.create_dispatch(ref=main_branch) def create_or_update_pr_with_file( self, diff --git a/.github/workflows/nowa-organizacja.yaml b/.github/workflows/nowa-organizacja.yaml index fecdf19..57ec749 100644 --- a/.github/workflows/nowa-organizacja.yaml +++ b/.github/workflows/nowa-organizacja.yaml @@ -4,15 +4,11 @@ on: issues: types: [opened, edited] - -env: - GITHUB_TOKEN: ${{ github.token }} - permissions: contents: write issues: write pull-requests: write - + jobs: validate-form: @@ -47,6 +43,7 @@ jobs: GITHUB_ISSUE_NUMBER: ${{ github.event.issue.number }} GITHUB_FORM_JSON: ${{ needs.validate-form.outputs.payload }} GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_PAT: ${{ secrets.CUSTOM_GITHUB_PAT }} working-directory: ./.github/scripts run: python cli.py From 94da4de7baa0521a35aff664beaabbaa7f2270da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:52:07 +0100 Subject: [PATCH 25/29] =?UTF-8?q?debug:=20run=20z=20u=C5=BCyciem=20PAT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 9abcab6..6bc39b1 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -115,8 +115,7 @@ def create_or_update_pr_with_file( self.create_or_update_remote_branch_with_file_commit( source_branch, new_branch, file_path, file_contents, commit_message ) - pr = self.get_or_create_pr(source_branch, new_branch, pr_title, pr_body) - self.dispatch_workflow() + return self.get_or_create_pr(source_branch, new_branch, pr_title, pr_body) def create_organization_yaml_pr( From eb09097346223ce46bcd9dbd77923db31d16896d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 14:53:57 +0100 Subject: [PATCH 26/29] =?UTF-8?q?usuni=C4=99cie=20debugu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 7 ------- .github/workflows/organization-update.yaml | 14 -------------- 2 files changed, 21 deletions(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index 6bc39b1..dd16ae7 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -93,14 +93,7 @@ def create_or_update_remote_branch_with_file_commit( branch, file_path, file_contents, commit_message ) branch.edit(commit.sha) - # self.dispatch_workflow(commit) return branch - # - # def dispatch_workflow(self, commit: GitCommit): - # github_commit = self.repo.get_commit(commit.sha) - # main_branch = self.repo.get_branch("main") - # workflow = self.repo.get_workflow("organization-update.yaml") - # workflow.create_dispatch(ref=main_branch) def create_or_update_pr_with_file( self, diff --git a/.github/workflows/organization-update.yaml b/.github/workflows/organization-update.yaml index 24e359d..a4d4dfc 100644 --- a/.github/workflows/organization-update.yaml +++ b/.github/workflows/organization-update.yaml @@ -7,7 +7,6 @@ on: pull_request: paths: - 'organizations/*.yaml' - workflow_dispatch: permissions: contents: read @@ -19,19 +18,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch full history to ensure all commits are accessible - - name: Show changed files - run: | - if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then - echo "Initial commit or new branch. Listing all files:" - git ls-files - else - echo "Changed files since previous commit:" - git diff --name-only ${{ github.event.before }} ${{ github.sha }} - fi - - name: Print GitHub Context - run: echo "${{ toJson(github) }}" - uses: ibiqlik/action-yamllint@v3 with: file_or_dir: organizations/*.yaml From 290719c746a9958f2f006de56851e112ef77d9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 15:04:31 +0100 Subject: [PATCH 27/29] =?UTF-8?q?naprawienie=20pustych=20spacji,=20gdy=20n?= =?UTF-8?q?ie=20ma=20warto=C5=9Bci=20dla=20klucza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/organization.yaml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/organization.yaml.j2 b/.github/scripts/organization.yaml.j2 index c808a5d..43bc3a3 100644 --- a/.github/scripts/organization.yaml.j2 +++ b/.github/scripts/organization.yaml.j2 @@ -13,8 +13,8 @@ dostawa: miasto: {{ organization.city }} telefon: {{ organization.phone_number }} email: {{ organization.email }} - kod_paczkomatu: {{ organization.package_box_code }} - dodatkowe_informacje: {{ organization.additional_info }} + kod_paczkomatu:{% if organization.package_box_code %} {{ organization.package_box_code }}{% endif %} + dodatkowe_informacje:{% if organization.additional_info %} {{ organization.additional_info }}{% endif %} produkty: - nazwa: Testowy produkt From 6d552d97264f271286a8848798b9e669cc7f77a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 15:17:51 +0100 Subject: [PATCH 28/29] =?UTF-8?q?usuni=C4=99ty=20zb=C4=99dny=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/git_managers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/scripts/git_managers.py b/.github/scripts/git_managers.py index dd16ae7..ddbe34f 100644 --- a/.github/scripts/git_managers.py +++ b/.github/scripts/git_managers.py @@ -2,7 +2,6 @@ from dataclasses import dataclass from github import InputGitTreeElement -from github.Commit import Commit from github.GithubException import UnknownObjectException from github.GitCommit import GitCommit from github.GitRef import GitRef From de0d0d7696309600c2d76e9a9d9e6db07d1c8c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=22Ivellios=22=20Kamie=C5=84ski?= Date: Fri, 20 Dec 2024 17:05:06 +0100 Subject: [PATCH 29/29] =?UTF-8?q?refactoring=20-=20uproszczenie=20mapowani?= =?UTF-8?q?a=20p=C3=B3l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/renderers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/renderers.py b/.github/scripts/renderers.py index 3b64b81..1893f32 100644 --- a/.github/scripts/renderers.py +++ b/.github/scripts/renderers.py @@ -13,8 +13,8 @@ def render_organization_yaml(data: GithubIssueFormDataParser): template = env.get_template("organization.yaml.j2") org_data = { - field: data.get(str(OrgFormSchemaIds[field])) - for field in OrgFormSchemaIds.__members__.keys() + field.name: data.get(field.value) + for field in OrgFormSchemaIds } return template.render(organization=org_data)