mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-04-27 15:31:21 +00:00
feat: Added gh-pages
cleanup deleted branches
This commit is contained in:
parent
65da71e309
commit
bdcde61ab2
1 changed files with 25 additions and 0 deletions
25
.github/workflows/gh-pages-cleanup.yaml
vendored
Normal file
25
.github/workflows/gh-pages-cleanup.yaml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: Cleanup Directory on Branch Deletion
|
||||
|
||||
on:
|
||||
delete
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Delete directory in gh-pages
|
||||
if: github.event.ref_type == 'branch'
|
||||
run: |
|
||||
branchName=$(echo "${{ github.ref }}" | sed -e 's,^refs/heads/,,')
|
||||
if [ -d "./.unlighthouse/${branchName}" ]; then
|
||||
git fetch --all
|
||||
git checkout gh-pages
|
||||
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
|
Loading…
Reference in a new issue