mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-04-27 15:31:21 +00:00
29 lines
811 B
YAML
29 lines
811 B
YAML
name: Cleanup GitHub Pages on Branch Deletion
|
|
|
|
on:
|
|
delete
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
cleanup:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.5.3
|
|
|
|
- name: Delete directory in gh-pages
|
|
if: github.event.ref_type == 'branch'
|
|
run: |
|
|
git fetch --all
|
|
git checkout gh-pages
|
|
git pull
|
|
branchName=$(echo "${{ github.event.ref }}" | sed -e 's,^refs/heads/,,')
|
|
if [ -d "./.unlighthouse/${branchName}" ]; then
|
|
git rm -rf --ignore-unmatch "${branchName}"
|
|
git commit -m "Cleanup directory for deleted branch ${branchName}"
|
|
git push origin gh-pages
|
|
else
|
|
echo "Directory doesn't exist for branch ${branchName}"
|
|
fi
|