adblock/.github/workflows/optimize_master.yml

36 lines
963 B
YAML

name: Optimize Repository
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 */3 *'
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@v2
with:
ref: master
- name: Run git cleanup commands
run: |
git reflog expire --expire=now --all
git gc --aggressive --prune=now
- name: Clear commit history
run: |
git config --local user.email "${{ secrets.MYEMAIL }}"
git config --local user.name "${{ secrets.MYUSERNAME }}"
git checkout --orphan temp_branch
git add .
git commit -m "clear"
git branch -D master
git branch -m master
git remote set-url origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f origin master