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: Update README with Problem Count | |
| on: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '0 0 * * *' # Runs daily at midnight | |
| jobs: | |
| update-readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Count problems solved | |
| run: | | |
| PROBLEM_COUNT=$(find . -type f \( -name "*.cpp" -o -name "*.c" -o -name "*.py" \) | wc -l) | |
| echo "Total Problems Solved: $PROBLEM_COUNT" | |
| sed -i "s/Total Problems Solved: {count}/Total Problems Solved: $PROBLEM_COUNT/" README.md | |
| - name: Commit and push changes | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| git add README.md | |
| git commit -m "Updated problem count in README" || exit 0 | |
| git push |