diff --git a/.github/workflows/daily-commit-link.yml b/.github/workflows/daily-commit-link.yml new file mode 100644 index 00000000..b8716e65 --- /dev/null +++ b/.github/workflows/daily-commit-link.yml @@ -0,0 +1,35 @@ +name: Daily Commit Link and POTD Badge Tracker + +on: + push: + branches: + - main # or your default branch name + schedule: + - cron: '0 0 * * *' # This will run daily at midnight UTC + workflow_dispatch: + +jobs: + update-link: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Install requests + run: pip install requests + + - name: Update README with the Latest Commit + run: python update_commit.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} README.md + + - name: Commit and Push Changes + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add README.md + git diff-index --quiet HEAD || git commit -m "Update latest commit and POTD badge" + git push diff --git a/.github/workflows/update_readme.yml b/.github/workflows/update_readme.yml deleted file mode 100644 index 14bcd6ee..00000000 --- a/.github/workflows/update_readme.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Update Latest Solution Link and Badge - -on: - schedule: - - cron: '0 0 * * *' # Runs daily at midnight UTC - workflow_dispatch: - -jobs: - update-readme: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.8' - - - name: Install Requests Library - run: pip install requests - - - name: Update README with Latest Commit Link - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python src/update_readme.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} README.md "01(Nov)*.md" - - - name: Commit and Push Changes - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add README.md - git commit -m "Update README with latest solution link and badge" || echo "No changes to commit" - git push