Skip to content

clean-demo-site

clean-demo-site #112

name: clean-demo-site
on:
delete:
pull_request:
branches:
- development
- release-*
types:
- closed
jobs:
clean-demo-site:
runs-on: ubuntu-latest
concurrency:
group: hds-demo-${{ github.ref }}
steps:
- name: Checkout code hds-demo
uses: actions/checkout@v4
with:
repository: City-of-Helsinki/hds-demo
path: hds-demo
ssh-key: ${{ secrets.HDSDEMO_SSH_DEPLOY_KEY }}
- name: Remove preview directory
id: remove_preview
run: |
if [ -d "./docs/preview_${{ github.event.number != '' && github.event.number || github.ref_name }}" ] ; then
rm -fr ./docs/preview_${{ github.event.number != '' && github.event.number || github.ref_name }}
echo "preview_exists=true" >> $GITHUB_OUTPUT
else
echo "preview_exists=false" >> $GITHUB_OUTPUT
fi
working-directory: ./hds-demo
- name: Commit
if: steps.remove_preview.outputs.preview_exists == 'true'
run: |
git config --global user.email "hds@hel.fi"
git config --global user.name "Github Actions"
git status
git add .
git commit -m "chore: hds-demo-preview-clean workflow updated pr ${{ github.event.number != '' && github.event.number || github.ref_name }}"
git pull --rebase || (sleep 20 && git pull --rebase)
git push
working-directory: ./hds-demo