Auto Commit Activity #579
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 Activity | |
| on: | |
| schedule: | |
| # Multiple times throughout the day for 4-26 commits daily with random variance | |
| - cron: '0 1 * * *' # 1:00 AM UTC | |
| - cron: '30 3 * * *' # 3:30 AM UTC | |
| - cron: '15 6 * * *' # 6:15 AM UTC | |
| - cron: '45 8 * * *' # 8:45 AM UTC | |
| - cron: '30 10 * * *' # 10:30 AM UTC | |
| - cron: '15 12 * * *' # 12:15 PM UTC | |
| - cron: '45 14 * * *' # 2:45 PM UTC | |
| - cron: '30 16 * * *' # 4:30 PM UTC | |
| - cron: '15 18 * * *' # 6:15 PM UTC | |
| - cron: '45 20 * * *' # 8:45 PM UTC | |
| - cron: '30 22 * * *' # 10:30 PM UTC | |
| - cron: '15 0 * * *' # 12:15 AM UTC (next day) | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| auto-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # Use Personal Access Token for proper attribution | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Configure Git | |
| run: | | |
| # Use your GitHub email to ensure commits count on your profile | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "suntiwari3495-arch" | |
| # Debug: Show current branch and configuration | |
| echo "=== Git Configuration ===" | |
| echo "Current Branch: $(git branch --show-current)" | |
| echo "User Name: $(git config --local user.name)" | |
| echo "User Email: $(git config --local user.email)" | |
| echo "Remote URL: $(git remote get-url origin)" | |
| - name: Run update | |
| run: python .github/scripts/update_activity.py | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git add . | |
| if git diff --cached --quiet; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "No changes to commit" | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected, will commit" | |
| fi | |
| - name: Commit changes | |
| if: steps.check_changes.outputs.has_changes == 'true' | |
| run: | | |
| # Verify we're on the correct branch for contribution graph | |
| CURRENT_BRANCH=$(git branch --show-current) | |
| echo "Committing to branch: $CURRENT_BRANCH" | |
| if [ "$CURRENT_BRANCH" != "main" ] && [ "$CURRENT_BRANCH" != "master" ]; then | |
| echo "⚠️ WARNING: Not on default branch. Commits may not count toward contribution graph." | |
| else | |
| echo "✅ Committing to default branch. Commits will count toward contribution graph." | |
| fi | |
| git commit -m "$(python .github/scripts/generate_commit_message.py)" | |
| git push | |
| # Show commit details | |
| echo "=== Latest Commit ===" | |
| git log --oneline -1 --pretty=format:"%h - %an <%ae> - %s" | |