Delete old BackstopJS preview pages #30
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: Delete old BackstopJS preview pages | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '5 4 * * *' | |
concurrency: | |
group: visual-regression | |
jobs: | |
visual-regression-cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Git user | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
- name: Remove the folder | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
for d in pull/*; do | |
id=$(echo $d | cut -d / -f2) | |
state=$(gh pr view $id --repo City-of-Helsinki/drupal-hdbt --json state --jq .state) | |
if [ "$state" != "OPEN" ]; then | |
rm -r pull/$id | |
fi | |
done | |
if [[ $(git status --porcelain) ]]; then | |
git add . | |
git commit -m 'Automated commit' | |
git push | |
fi | |