Skip to content

garbage collection

garbage collection #27

Workflow file for this run

name: garbage collection
on:
workflow_dispatch:
# https://crontab.guru/#0_1_1_*_*
schedule:
- cron: "0 1 1 * *"
permissions:
actions: write
contents: write
id-token: write
jobs:
garbage_collection:
name: Remove old build result on GH page
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- id: remove
run: |
ALL_FOLDERS=$(ls -d */)
echo ALL_FOLDERS=$ALL_FOLDERS
if [ -z "$ALL_FOLDERS" ]; then
echo "result=''" >> $GITHUB_OUTPUT
else
rm -r $ALL_FOLDERS
git add .
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "docs: 🤖 garbage collection old build results"
echo "result=1" >> $GITHUB_OUTPUT
fi
- name: Push changes
uses: ad-m/github-push-action@master
if: ${{ steps.remove.outputs.result == 1 }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
trigger_schedule:
name: Schedule
needs: [garbage_collection]
uses: ./.github/workflows/schedule.yml
secrets:
SOURCE_TREE_PROTECTED_BRANCH_TOKEN: ${{ secrets.SOURCE_TREE_PROTECTED_BRANCH_TOKEN }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}