Cleanup Old Ics #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cleanup Old Ics | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # Run every Sunday at 00:00 UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Create a new branch | |
run: | | |
git checkout -b cleanup/remove-old-ics | |
- name: Find and remove ics not updated in the last year | |
run: | | |
find ics -type f -not -newermt '1 week ago' -exec git rm {} \; | |
- name: Commit changes | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -am "Remove ics not updated in the last year" || echo "No changes to commit" | |
- name: Push changes | |
run: | | |
git pull --rebase origin main | |
git push origin cleanup/remove-old-ics --force | |
- name: Create Pull Request | |
run: | | |
gh pr create \ | |
--title "chore: remove old ics" \ | |
--body "This PR removes files that have not been updated in the last year." \ | |
--base main \ | |
--head cleanup/remove-old-ics || echo "No changes" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |