Skip to content

debugging import

debugging import #13

name: Check for new model directories in views_pipeline/models
on:
push:
branches:
- create_pgm_catalog_01
- main
workflow_dispatch:
jobs:
check-new-folder:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for new directories and generate catalog if models directory has changed
run: |
git status
# List all directories currently in the views_pipeline/models folder
current_dirs=$(find models -type d -maxdepth 1)
echo $current_dirs
# Fetch the previous commit from the main branch to compare
parent_commit=$(git rev-parse HEAD~1)
echo $parent_commit
git checkout 7fdf35d1e250f3270936a97502613c0b5d013f5a
# List directories from the previous commit
previous_dirs=$(find models -type d -maxdepth 1)
echo $previous_dirs
# Compare the directories
new_dirs=$(comm -13 <(echo "$previous_dirs" | sort) <(echo "$current_dirs" | sort))
echo "New folders detected in views_pipeline/models: $new_dirs"
removed_dirs=$(comm -23 <(echo "$previous_dirs" | sort) <(echo "$current_dirs" | sort))
echo "Removed folders detected in views_pipeline/models: $removed_dirs"
git checkout create_pgm_catalog_01
git status
# generate catalog if models directory has changed
ls -la
echo $new_dirs
echo $removed_dirs
if [ -n "$new_dirs" ] || [ -n "$removed_dirs" ]; then
python documentation/catalogs/generate_model_catalog.py
echo "Model catalog is updated."
else
echo "No new or removed folders detected."
fi
working-directory: ./views_pipeline
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Commit and Push Changes
run: |
git add documentation/catalogs/cm_model_catalog.md documentation/catalogs/pgm_model_catalog.md
git commit -m "Automated changes by GitHub Actions" || echo "Nothing to commit"
git push https://${{ secrets.VIEWS_PIPELINE_ACCESS_TOKEN }}:[email protected]/prio-data/views_pipeline.git