Cleanup Output Directory #10
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 Output Directory | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs every 24 hours | |
workflow_dispatch: | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # Disable default GitHub token | |
- name: Remove Output Directory Contents | |
run: | | |
rm -rf output/* # Deletes all files inside output directory | |
- name: Commit and Push Changes | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add output/ | |
git commit -m "Cleanup: Deleted all files inside output directory" || echo "No changes to commit" | |
git push https://x-access-token:${GH_PAT}@github.com/iArchitSharma/thebrief.git HEAD:main |