Auto Commit #74
This file contains hidden or 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: Auto Commit | |
| on: | |
| schedule: | |
| # Runs every day at 00:00 UTC | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| auto-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| persist-credentials: true | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "wahyuivanmahendra@gmail.com" | |
| git config --local user.name "Wahyu Ivan" | |
| - name: Create commit | |
| run: | | |
| echo "Last updated: $(date)" >> activity.log | |
| git add activity.log | |
| git commit -m "Auto commit: $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes to commit" | |
| - name: Push changes | |
| run: | | |
| git push origin main || git push origin master | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |