From f5189d3a56b086326579fa3be2c8525045f9055d Mon Sep 17 00:00:00 2001 From: Nicolas Oudard Date: Wed, 11 Dec 2024 16:56:11 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Exporter=20les=20Acteurs=20selon=20la=20lic?= =?UTF-8?q?ence=20=C3=A0=20appliquer=20=C3=A0=20la=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qfdmo/admin/acteur.py | 44 ++++++++---- .../commands/export_displayedacteur.py | 53 ++++++++++++--- ...t_open_source_displayedacteur_ressource.py | 68 ++++++++++++++++--- 3 files changed, 133 insertions(+), 32 deletions(-) diff --git a/qfdmo/admin/acteur.py b/qfdmo/admin/acteur.py index 1608503c7..10fc090df 100644 --- a/qfdmo/admin/acteur.py +++ b/qfdmo/admin/acteur.py @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, List import orjson from django import forms @@ -566,20 +566,25 @@ class OpenSourceDisplayedActeurResource(resources.ModelResource): limit = 0 offset = 0 + licenses = [] - def __init__(self, limit=0, offset=0, **kwargs): + def __init__( + self, limit: int = 0, offset: int = 0, licenses: List[str] = [], **kwargs + ): self.limit = limit self.offset = offset + self.licenses = licenses super().__init__(**kwargs) uuid = fields.Field(column_name="Identifiant", attribute="uuid", readonly=True) - sources = fields.Field( - column_name="Contributeurs", attribute="sources", readonly=True - ) + sources = fields.Field(column_name="Paternité", attribute="sources", readonly=True) def dehydrate_sources(self, acteur): sources = ["Longue Vie Aux Objets", "ADEME"] - sources.extend([f"{source.libelle}" for source in acteur.sources.all()]) + acteur_sources = acteur.sources.all() + if self.licenses: + acteur_sources = acteur_sources.filter(licence__in=self.licenses) + sources.extend([f"{source.libelle}" for source in acteur_sources]) seen = set() deduplicated_sources = [] for source in sources: @@ -682,10 +687,22 @@ def dehydrate_propositions_services(self, acteur): ) def get_queryset(self): + queryset = super().get_queryset() + + queryset = queryset.prefetch_related( + "sources", + "labels", + "proposition_services__sous_categories", + "proposition_services__action", + ) + + # Only Actif queryset = queryset.filter( statut=ActeurStatus.ACTIF, - ).exclude( + ) + # Exclude acteurs only professionals + queryset = queryset.exclude( public_accueilli__in=[ ActeurPublicAccueilli.AUCUN, ActeurPublicAccueilli.PROFESSIONNELS, @@ -695,16 +712,15 @@ def get_queryset(self): queryset = queryset.exclude( identifiant_unique__icontains="_reparation_", ) - - queryset = queryset.prefetch_related( - "sources", - "labels", - "proposition_services__sous_categories", - "proposition_services__action", - ) + # Export only acteurs with expected licenses + if self.licenses: + queryset = queryset.filter(sources__licence__in=self.licenses) + queryset = queryset.distinct() queryset = queryset.order_by("uuid") + if self.limit: return queryset[self.offset : self.offset + self.limit] + return queryset class Meta: diff --git a/qfdmo/management/commands/export_displayedacteur.py b/qfdmo/management/commands/export_displayedacteur.py index 15ffece48..9ae03689b 100644 --- a/qfdmo/management/commands/export_displayedacteur.py +++ b/qfdmo/management/commands/export_displayedacteur.py @@ -8,6 +8,7 @@ from django.core.management.base import BaseCommand from qfdmo.admin import OpenSourceDisplayedActeurResource +from qfdmo.models.acteur import DataLicense CHUNK = 1000 @@ -15,10 +16,43 @@ class Command(BaseCommand): help = "Export Ressources using CSV format" + def add_arguments(self, parser): + parser.add_argument( + "--file", + type=str, + help="File to export to", + default=(f"export_acteur_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"), + ) + parser.add_argument( + "--licenses", + nargs="+", + action="extend", + type=str, + help=( + f"Licenses to export, options : {DataLicense.values}, " + f"default: '{DataLicense.OPEN_LICENSE.value}'" + ), + ) + def handle(self, *args, **options): - self.stdout.write(f"Exporting Ressources, starting at {datetime.now()}") - target_file = datetime.now().strftime( - "exports/export_acteur_%Y%m%d_%H%M%S.xlsx" + self.stdout.write( + self.style.SUCCESS(f"Exporting Ressources, starting at {datetime.now()}") + ) + target_file = "exports/" + options["file"] + licenses = options["licenses"] + if not licenses: + licenses = [DataLicense.OPEN_LICENSE.value] + if not all(license in DataLicense.values for license in licenses): + self.stdout.write( + self.style.ERROR( + f"Invalid licenses, options : {licenses}, " + f"Available values: '{DataLicense.values}'" + ) + ) + return + + self.stdout.write( + self.style.SUCCESS(f"Exporting DisplayedActeur using licenses: {licenses}") ) with tempfile.NamedTemporaryFile(mode="w+b", suffix=".xlsx") as tmp_file: @@ -31,12 +65,14 @@ def handle(self, *args, **options): offset = 0 dataset = OpenSourceDisplayedActeurResource( - limit=CHUNK, offset=offset + limit=CHUNK, offset=offset, licenses=licenses ).export() sheet.append(dataset.headers) while dataset.dict: - self.stdout.write(f"Exporting {offset} to {offset + CHUNK}") + self.stdout.write( + self.style.SUCCESS(f"Exporting {offset} to {offset + CHUNK}") + ) dataset.headers = None for row in dataset.dict: @@ -44,13 +80,12 @@ def handle(self, *args, **options): offset += CHUNK dataset = OpenSourceDisplayedActeurResource( - limit=CHUNK, offset=offset + limit=CHUNK, offset=offset, licenses=licenses ).export() - - self.stdout.write(f"Writing to {target_file}") + self.stdout.write(self.style.SUCCESS(f"Writing to {target_file}")) workbook.save(tmp_file.name) tmp_file.seek(0) default_storage.save(target_file, ContentFile(tmp_file.read())) - self.stdout.write(f"Ended at {datetime.now()}") + self.stdout.write(self.style.SUCCESS(f"Ended at {datetime.now()}")) diff --git a/unit_tests/qfdmo/test_open_source_displayedacteur_ressource.py b/unit_tests/qfdmo/test_open_source_displayedacteur_ressource.py index ccbb42d76..c335a0912 100644 --- a/unit_tests/qfdmo/test_open_source_displayedacteur_ressource.py +++ b/unit_tests/qfdmo/test_open_source_displayedacteur_ressource.py @@ -1,6 +1,7 @@ import pytest from qfdmo.admin.acteur import OpenSourceDisplayedActeurResource +from qfdmo.models.acteur import DataLicense from unit_tests.qfdmo.acteur_factory import ( DisplayedActeurFactory, DisplayedPropositionServiceFactory, @@ -22,7 +23,7 @@ def test_export_columns(self): for row in dataset.dict: assert list(row.keys()) == [ "Identifiant", - "Contributeurs", + "Paternité", "Nom", "Nom commercial", "SIREN", @@ -99,18 +100,18 @@ def test_propositions_de_services(self): ) @pytest.mark.parametrize( - "source_data, expected_contributeurs", + "source_data, expected_other_contributeurs", [ ( [], - "Longue Vie Aux Objets|ADEME", + [], ), ( [ {"libelle": "Source 1", "code": "source1"}, {"libelle": "Source 2", "code": "source2"}, ], - "Longue Vie Aux Objets|ADEME|Source 1|Source 2", + ["Source 1", "Source 2"], ), ( [ @@ -118,11 +119,11 @@ def test_propositions_de_services(self): {"libelle": "Source 2", "code": "source2"}, {"libelle": "Source 1", "code": "source3"}, ], - "Longue Vie Aux Objets|ADEME|Source 1|Source 2", + ["Source 1", "Source 2"], ), ], ) - def test_sources(self, source_data, expected_contributeurs): + def test_sources(self, source_data, expected_other_contributeurs): displayedacteur = DisplayedActeurFactory() sources = [SourceFactory(**data) for data in source_data] displayedacteur.sources.set(sources) @@ -131,8 +132,57 @@ def test_sources(self, source_data, expected_contributeurs): dataset_dict = dataset.dict - contributeurs = dataset_dict[0]["Contributeurs"].split("|") + contributeurs = dataset_dict[0]["Paternité"].split("|") assert contributeurs[0] == "Longue Vie Aux Objets" assert contributeurs[1] == "ADEME" - other_contributeurs = set(contributeurs[2:]) - assert sorted(contributeurs[2:]) == sorted(other_contributeurs) + assert sorted(contributeurs[2:]) == sorted(expected_other_contributeurs) + + def test_filter_by_licenses(self): + source_open_licence = SourceFactory(licence=DataLicense.OPEN_LICENSE.value) + source_cc_by_nc_sa = SourceFactory(licence=DataLicense.CC_BY_NC_SA.value) + acteur_open_license = DisplayedActeurFactory() + acteur_open_license.sources.set([source_open_licence]) + acteur_multi_licences = DisplayedActeurFactory() + acteur_multi_licences.sources.set([source_open_licence, source_cc_by_nc_sa]) + acteur_cc_license = DisplayedActeurFactory.create() + acteur_cc_license.sources.set([source_cc_by_nc_sa]) + + dataset = OpenSourceDisplayedActeurResource( + licenses=[DataLicense.OPEN_LICENSE.value, DataLicense.CC_BY_NC_SA.value] + ).export() + + identifiants = [row["Identifiant"] for row in dataset.dict] + assert len(dataset) == 3 + assert acteur_open_license.uuid in identifiants + assert acteur_multi_licences.uuid in identifiants + assert acteur_cc_license.uuid in identifiants + + dataset = OpenSourceDisplayedActeurResource( + licenses=[DataLicense.OPEN_LICENSE.value] + ).export() + + identifiants = [row["Identifiant"] for row in dataset.dict] + assert len(dataset) == 2 + assert acteur_open_license.uuid in identifiants + assert acteur_multi_licences.uuid in identifiants + + # test acteur_multi doesn't refer license CC_BY_NC_SA + row_multi = next( + row + for row in dataset.dict + if row["Identifiant"] == acteur_multi_licences.uuid + ) + assert row_multi["Identifiant"] == acteur_multi_licences.uuid + assert ( + row_multi["Paternité"] + == f"Longue Vie Aux Objets|ADEME|{source_open_licence.libelle}" + ) + + dataset = OpenSourceDisplayedActeurResource( + licenses=[DataLicense.CC_BY_NC_SA.value] + ).export() + + identifiants = [row["Identifiant"] for row in dataset.dict] + assert len(dataset) == 2 + assert acteur_multi_licences.uuid in identifiants + assert acteur_cc_license.uuid in identifiants From 31894e6480b07fad7bedc6de6ccdd0f000b35c13 Mon Sep 17 00:00:00 2001 From: Nicolas Oudard Date: Wed, 11 Dec 2024 18:37:43 +0100 Subject: [PATCH 2/4] Ajout de l'export en CI --- .github/actions/export_acteur/actions.yml | 57 +++++++++++++++++++ .../preprod_export_acteur_open_license.yml | 33 +++++++++++ .../prod_export_acteur_open_license.yml | 35 ++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 .github/actions/export_acteur/actions.yml create mode 100644 .github/workflows/preprod_export_acteur_open_license.yml create mode 100644 .github/workflows/prod_export_acteur_open_license.yml diff --git a/.github/actions/export_acteur/actions.yml b/.github/actions/export_acteur/actions.yml new file mode 100644 index 000000000..cac26976b --- /dev/null +++ b/.github/actions/export_acteur/actions.yml @@ -0,0 +1,57 @@ +name: "Export Displayed Acteur" +description: "Export displayed acteur and upload to S3" +inputs: + SCALINGO_API_TOKEN: + description: "Duplicate API token" + required: true + SCALINGO_APP: + description: "Scalingo production app" + required: true + S3_HOST: + description: "S3 host URL" + required: true + S3_BUCKET: + description: "S3 production bucket" + required: true + AWS_ACCESS_KEY_ID: + description: "AWS access key ID" + required: true + AWS_SECRET_ACCESS_KEY: + description: "AWS secret access key" + required: true + FILE_NAME: + description: "File name for the exported file" + required: false + default: "exported_displayedacteur.csv" + SCALINGO_APP_REGION: + description: "Scalingo region for the app" + required: false + default: "osc-fr1" + +runs: + using: "composite" + steps: + - name: Install Scalingo CLI + uses: scalingo-community/setup-scalingo@v0.1.1 + with: + region: ${{ inputs.SCALINGO_APP_REGION }} + - name: Login Scalingo CLI + run: | + scalingo login --api-token ${{ inputs.SCALINGO_API_TOKEN }} + - name: Generate timestamped file name + id: generate_filename + run: | + TIMESTAMP=$(date +'%Y%m%d_%H%M%S') + echo "TIMESTAMPED_FILE_NAME=${TIMESTAMP}_${{ inputs.FILE_NAME }}" >> $GITHUB_ENV + - name: Execute sync script in one-off container + run: | + scalingo --app ${{ inputs.SCALINGO_APP }} run \ + python manage.py export_displayedacteur --file ${{ env.TIMESTAMPED_FILE_NAME }} + continue-on-error: true + - name: Get file from s3 + run: | + aws --endpoint-url ${{ inputs.S3_HOST }} s3 cp ${{ inputs.S3_BUCKET }}/exports/${{ env.TIMESTAMPED_FILE_NAME }} ${{ env.TIMESTAMPED_FILE_NAME }} + - name: Save file to artefact + uses: actions/upload-artifact@v2 + with: + path: ${{ env.TIMESTAMPED_FILE_NAME }} diff --git a/.github/workflows/preprod_export_acteur_open_license.yml b/.github/workflows/preprod_export_acteur_open_license.yml new file mode 100644 index 000000000..d4f350ba7 --- /dev/null +++ b/.github/workflows/preprod_export_acteur_open_license.yml @@ -0,0 +1,33 @@ +name: "✅ Export des Acteurs sous licence ouverte en PREPROD" + +on: + workflow_dispatch: + +env: + DUPLICATE_API_TOKEN: ${{ secrets.DUPLICATE_API_TOKEN }} + PREPROD_APP: ${{ secrets.SCALINGO_PREPROD_APP }} + S3_HOST: https://cellar-c2.services.clever-cloud.com + S3_PREPROD_BUCKET: ${{ secrets.LVAO_S3_PREPROD_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.LVAO_S3_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.LVAO_S3_SECRET_KEY }} + +defaults: + run: + shell: bash + +jobs: + export_acteur_open_license_preprod: + name: ✅ Export des Acteurs sous licence ouverte en PREPROD + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Export Displayed Acteur + uses: ./.github/actions/export_displayedacteur + with: + SCALINGO_API_TOKEN: ${{ env.DUPLICATE_API_TOKEN }} + SCALINGO_APP: ${{ env.PREPROD_APP }} + S3_HOST: ${{ env.S3_HOST }} + S3_BUCKET: ${{ env.S3_PREPROD_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/prod_export_acteur_open_license.yml b/.github/workflows/prod_export_acteur_open_license.yml new file mode 100644 index 000000000..35a93ecb6 --- /dev/null +++ b/.github/workflows/prod_export_acteur_open_license.yml @@ -0,0 +1,35 @@ +name: "🛑 Export des Acteurs sous licence ouverte en PROD" + +on: + workflow_dispatch: + schedule: + - cron: "0 2 * * SUN" + +env: + DUPLICATE_API_TOKEN: ${{ secrets.DUPLICATE_API_TOKEN }} + PRODUCTION_APP: ${{ secrets.SCALINGO_PRODUCTION_APP }} + S3_HOST: https://cellar-c2.services.clever-cloud.com + S3_PRODUCTION_BUCKET: ${{ secrets.LVAO_S3_PRODUCTION_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.LVAO_S3_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.LVAO_S3_SECRET_KEY }} + +defaults: + run: + shell: bash + +jobs: + export_acteur_open_license_preprod: + name: Export des Acteurs sous licence ouverte en PROD + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Export Displayed Acteur + uses: ./.github/actions/export_displayedacteur + with: + SCALINGO_API_TOKEN: ${{ env.DUPLICATE_API_TOKEN }} + SCALINGO_APP: ${{ env.PRODUCTION_APP }} + S3_HOST: ${{ env.S3_HOST }} + S3_BUCKET: ${{ env.S3_PRODUCTION_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} From ebd33d5ac293059fb56c2f7812049b99b1d8187c Mon Sep 17 00:00:00 2001 From: Nicolas Oudard Date: Wed, 11 Dec 2024 23:20:49 +0100 Subject: [PATCH 3/4] test on pull request --- .github/actions/export_acteur/{actions.yml => action.yml} | 6 +++++- .github/workflows/preprod_export_acteur_open_license.yml | 2 +- .github/workflows/prod_export_acteur_open_license.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) rename .github/actions/export_acteur/{actions.yml => action.yml} (94%) diff --git a/.github/actions/export_acteur/actions.yml b/.github/actions/export_acteur/action.yml similarity index 94% rename from .github/actions/export_acteur/actions.yml rename to .github/actions/export_acteur/action.yml index cac26976b..a2e04439d 100644 --- a/.github/actions/export_acteur/actions.yml +++ b/.github/actions/export_acteur/action.yml @@ -36,22 +36,26 @@ runs: with: region: ${{ inputs.SCALINGO_APP_REGION }} - name: Login Scalingo CLI + shell: bash run: | scalingo login --api-token ${{ inputs.SCALINGO_API_TOKEN }} - name: Generate timestamped file name id: generate_filename + shell: bash run: | TIMESTAMP=$(date +'%Y%m%d_%H%M%S') echo "TIMESTAMPED_FILE_NAME=${TIMESTAMP}_${{ inputs.FILE_NAME }}" >> $GITHUB_ENV - name: Execute sync script in one-off container + shell: bash run: | scalingo --app ${{ inputs.SCALINGO_APP }} run \ python manage.py export_displayedacteur --file ${{ env.TIMESTAMPED_FILE_NAME }} continue-on-error: true - name: Get file from s3 + shell: bash run: | aws --endpoint-url ${{ inputs.S3_HOST }} s3 cp ${{ inputs.S3_BUCKET }}/exports/${{ env.TIMESTAMPED_FILE_NAME }} ${{ env.TIMESTAMPED_FILE_NAME }} - name: Save file to artefact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: path: ${{ env.TIMESTAMPED_FILE_NAME }} diff --git a/.github/workflows/preprod_export_acteur_open_license.yml b/.github/workflows/preprod_export_acteur_open_license.yml index d4f350ba7..e5239dac2 100644 --- a/.github/workflows/preprod_export_acteur_open_license.yml +++ b/.github/workflows/preprod_export_acteur_open_license.yml @@ -23,7 +23,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Export Displayed Acteur - uses: ./.github/actions/export_displayedacteur + uses: ./.github/actions/export_acteur with: SCALINGO_API_TOKEN: ${{ env.DUPLICATE_API_TOKEN }} SCALINGO_APP: ${{ env.PREPROD_APP }} diff --git a/.github/workflows/prod_export_acteur_open_license.yml b/.github/workflows/prod_export_acteur_open_license.yml index 35a93ecb6..9f36c36be 100644 --- a/.github/workflows/prod_export_acteur_open_license.yml +++ b/.github/workflows/prod_export_acteur_open_license.yml @@ -25,7 +25,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Export Displayed Acteur - uses: ./.github/actions/export_displayedacteur + uses: ./.github/actions/export_acteur with: SCALINGO_API_TOKEN: ${{ env.DUPLICATE_API_TOKEN }} SCALINGO_APP: ${{ env.PRODUCTION_APP }} From 042d2880afde16209945ff4f231b88c21ece5a99 Mon Sep 17 00:00:00 2001 From: Nicolas Oudard Date: Thu, 12 Dec 2024 14:56:35 +0100 Subject: [PATCH 4/4] remove CI execution, it was too long --- .github/actions/export_acteur/action.yml | 61 ------------------- .../preprod_export_acteur_open_license.yml | 33 ---------- .../prod_export_acteur_open_license.yml | 35 ----------- 3 files changed, 129 deletions(-) delete mode 100644 .github/actions/export_acteur/action.yml delete mode 100644 .github/workflows/preprod_export_acteur_open_license.yml delete mode 100644 .github/workflows/prod_export_acteur_open_license.yml diff --git a/.github/actions/export_acteur/action.yml b/.github/actions/export_acteur/action.yml deleted file mode 100644 index a2e04439d..000000000 --- a/.github/actions/export_acteur/action.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: "Export Displayed Acteur" -description: "Export displayed acteur and upload to S3" -inputs: - SCALINGO_API_TOKEN: - description: "Duplicate API token" - required: true - SCALINGO_APP: - description: "Scalingo production app" - required: true - S3_HOST: - description: "S3 host URL" - required: true - S3_BUCKET: - description: "S3 production bucket" - required: true - AWS_ACCESS_KEY_ID: - description: "AWS access key ID" - required: true - AWS_SECRET_ACCESS_KEY: - description: "AWS secret access key" - required: true - FILE_NAME: - description: "File name for the exported file" - required: false - default: "exported_displayedacteur.csv" - SCALINGO_APP_REGION: - description: "Scalingo region for the app" - required: false - default: "osc-fr1" - -runs: - using: "composite" - steps: - - name: Install Scalingo CLI - uses: scalingo-community/setup-scalingo@v0.1.1 - with: - region: ${{ inputs.SCALINGO_APP_REGION }} - - name: Login Scalingo CLI - shell: bash - run: | - scalingo login --api-token ${{ inputs.SCALINGO_API_TOKEN }} - - name: Generate timestamped file name - id: generate_filename - shell: bash - run: | - TIMESTAMP=$(date +'%Y%m%d_%H%M%S') - echo "TIMESTAMPED_FILE_NAME=${TIMESTAMP}_${{ inputs.FILE_NAME }}" >> $GITHUB_ENV - - name: Execute sync script in one-off container - shell: bash - run: | - scalingo --app ${{ inputs.SCALINGO_APP }} run \ - python manage.py export_displayedacteur --file ${{ env.TIMESTAMPED_FILE_NAME }} - continue-on-error: true - - name: Get file from s3 - shell: bash - run: | - aws --endpoint-url ${{ inputs.S3_HOST }} s3 cp ${{ inputs.S3_BUCKET }}/exports/${{ env.TIMESTAMPED_FILE_NAME }} ${{ env.TIMESTAMPED_FILE_NAME }} - - name: Save file to artefact - uses: actions/upload-artifact@v4 - with: - path: ${{ env.TIMESTAMPED_FILE_NAME }} diff --git a/.github/workflows/preprod_export_acteur_open_license.yml b/.github/workflows/preprod_export_acteur_open_license.yml deleted file mode 100644 index e5239dac2..000000000 --- a/.github/workflows/preprod_export_acteur_open_license.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "✅ Export des Acteurs sous licence ouverte en PREPROD" - -on: - workflow_dispatch: - -env: - DUPLICATE_API_TOKEN: ${{ secrets.DUPLICATE_API_TOKEN }} - PREPROD_APP: ${{ secrets.SCALINGO_PREPROD_APP }} - S3_HOST: https://cellar-c2.services.clever-cloud.com - S3_PREPROD_BUCKET: ${{ secrets.LVAO_S3_PREPROD_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.LVAO_S3_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.LVAO_S3_SECRET_KEY }} - -defaults: - run: - shell: bash - -jobs: - export_acteur_open_license_preprod: - name: ✅ Export des Acteurs sous licence ouverte en PREPROD - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Export Displayed Acteur - uses: ./.github/actions/export_acteur - with: - SCALINGO_API_TOKEN: ${{ env.DUPLICATE_API_TOKEN }} - SCALINGO_APP: ${{ env.PREPROD_APP }} - S3_HOST: ${{ env.S3_HOST }} - S3_BUCKET: ${{ env.S3_PREPROD_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/prod_export_acteur_open_license.yml b/.github/workflows/prod_export_acteur_open_license.yml deleted file mode 100644 index 9f36c36be..000000000 --- a/.github/workflows/prod_export_acteur_open_license.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: "🛑 Export des Acteurs sous licence ouverte en PROD" - -on: - workflow_dispatch: - schedule: - - cron: "0 2 * * SUN" - -env: - DUPLICATE_API_TOKEN: ${{ secrets.DUPLICATE_API_TOKEN }} - PRODUCTION_APP: ${{ secrets.SCALINGO_PRODUCTION_APP }} - S3_HOST: https://cellar-c2.services.clever-cloud.com - S3_PRODUCTION_BUCKET: ${{ secrets.LVAO_S3_PRODUCTION_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.LVAO_S3_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.LVAO_S3_SECRET_KEY }} - -defaults: - run: - shell: bash - -jobs: - export_acteur_open_license_preprod: - name: Export des Acteurs sous licence ouverte en PROD - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Export Displayed Acteur - uses: ./.github/actions/export_acteur - with: - SCALINGO_API_TOKEN: ${{ env.DUPLICATE_API_TOKEN }} - SCALINGO_APP: ${{ env.PRODUCTION_APP }} - S3_HOST: ${{ env.S3_HOST }} - S3_BUCKET: ${{ env.S3_PRODUCTION_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}