Skip to content

auto delete any binaries older #319

auto delete any binaries older

auto delete any binaries older #319

Workflow file for this run

name: auto delete any binaries older
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
auto-pruning:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Switch bin branch
run: |
git config --global user.name github-actions && git config --global user.email [email protected]
git switch --orphan bin && git pull origin bin
tar vvcf /tmp/git-branch-bin-newest-commit.tar bin/ .gitignore *.py
git switch --orphan bin1
tar vvxf /tmp/git-branch-bin-newest-commit.tar
git add -A
git commit -m 'prune any older history, just keep latest contents'
- name: Run bin-prune.py
id: prune
run: |
if python3 bin-prune.py
then
echo "STATUS=0" >> $GITHUB_OUTPUT
else
echo "STATUS=$?" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: ${{ steps.prune.outputs.STATUS == '0' }}
run: |
git add -A
git commit -m 'auto delete old binary' || true
git branch -D bin
git branch -M bin1 bin
git push origin bin -f