diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c9cba7b08eb..2b5a3cec30f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -44,6 +44,13 @@ jobs: # ======================= # Data Artifact Retrieval # ======================= + # The repository contains a generated seed copy of curated resources. + # Remove it before overlaying the artifact so rows removed from the + # source sheet cannot survive in the deployed site. + - name: Clear generated curated resources + run: | + find content/curated_resources -maxdepth 1 -type f ! -name '_index.md' -delete + - name: Try to download data artifact id: download-artifact uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 diff --git a/content/resources/resource.py b/content/resources/resource.py index b8a35ebfe2a..6066c7b2efd 100644 --- a/content/resources/resource.py +++ b/content/resources/resource.py @@ -87,6 +87,12 @@ def convert_row_to_file(df, fpath): If there are duplicates, an index is appended to the filename. """ + # Replace the generated collection rather than leaving files for rows that + # have been removed from the source sheet. + for path in fpath.iterdir(): + if path.is_file() and path.name != '_index.md': + path.unlink() + # Track filenames to handle duplicates filename_counts = {}