Skip to content

Delete old BackstopJS preview pages #189

Delete old BackstopJS preview pages

Delete old BackstopJS preview pages #189

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
with:
ref: gh-pages
- 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 --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