Temp Files Deletion #373
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Temp Files Deletion | |
on: | |
workflow_run: | |
workflows: ["JSON Generation"] | |
types: | |
- completed | |
jobs: | |
del_temp_files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the previous workflow | |
run: | | |
if [ ${{ github.event.workflow_run.conclusion == 'success' }} ]; then | |
echo "Previous workflow OK" | |
else | |
echo "Previous workflow in error" | |
exit 1 | |
fi | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Restore dependency cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Run JSON generation scripts | |
run: | | |
echo "Working Directory: $(pwd)" | |
echo "Files in Current Directory: $(ls -al)" | |
python scripts/090_Final_Actions/091_Delete_Temp_Files.py | |
- name: Commit changes | |
run: | | |
git config --global user.email "${{ secrets.GIT_EMAIL }}" | |
git config --global user.name "${{ secrets.GIT_USERNAME }}" | |
if git diff --quiet -- data/json/; then | |
echo "No changes in data/json directory. Skipping commit." | |
else | |
git add -A data/json | |
git commit -m "Update data/json" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git push | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sauvegarder le cache des dépendances | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |