Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltaranto committed Feb 11, 2025
1 parent 73a52a8 commit 46fc976
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/clean-up-previews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,33 @@ jobs:
ref: gh-pages

- name: Delete old preview directories
working-directory: scripts
run: ./cleanUpPreviews.sh
run: |
set -x
DATE_FROM_DAYS_AGO=`date --date="${{env.DAYS_OLD}} days ago" +"%Y"-"%m"-"%d" || date -v-${{env.DAYS_OLD}}d +"%Y"-"%m"-"%d"`;
echo "Days ago:"
echo $DATE_FROM_DAYS_AGO
echo "Preview dirs:"
echo $(find ${{ env.PREVIEW_DIR }} -mindepth 1 -maxdepth 1 -type d -print)
echo "Before commit:"
echo $(git log --before=$DATE_FROM_DAYS_AGO | tail -1)
for i in $(find ${{ env.PREVIEW_DIR }} -mindepth 1 -maxdepth 1 -type d -print); do
echo "Git log before date:"
echo $(git log --before=$DATE_FROM_DAYS_AGO $i | tail -1)
if [[ $(git log --before=${DATE_FROM_DAYS_AGO} $i | tail -1) ]]; then
echo "Deleting directory $i"
rm -rf $i
fi
done
if [[ $(git status --porcelain --untracked-files=no | wc -l) -eq 0 ]]; then
echo "No directories to clean up"
exit 0
fi
# git config --local user.name 'GitHub Actions'
# git config --local user.email '[email protected]'
# git add ${{ env.PREVIEW_DIR }}
# git commit --quiet -m "Clean up old preview directories"
# git push
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 0 additions & 28 deletions scripts/cleanUpPreviews.sh

This file was deleted.

0 comments on commit 46fc976

Please sign in to comment.