mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-04-28 07:51:20 +00:00
35 lines
1 KiB
YAML
35 lines
1 KiB
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
|
|
|
|
- run: |
|
|
echo GITHUB_ACTION: $GITHUB_ACTION
|
|
echo GITHUB_WORKFLOW: $GITHUB_WORKFLOW
|
|
echo GITHUB_EVENT_NAME: $GITHUB_EVENT_NAME
|
|
echo GITHUB_EVENT_PATH: $GITHUB_EVENT_PATH
|
|
cat $GITHUB_EVENT_PATH
|
|
|
|
- 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
|