Sync Kaggle Notebooks #129
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: Sync Kaggle Notebooks | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Runs daily at midnight | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.x | |
| - name: Install kaggle | |
| run: pip install kaggle | |
| - name: Download Kaggle notebook | |
| env: | |
| KAGGLE_USERNAME: ${{ secrets.KAGGLE_USERNAME }} | |
| KAGGLE_KEY: ${{ secrets.KAGGLE_KEY }} | |
| run: kaggle kernels pull jaydendrino/notebook4caf11ef97 -p src/ | |
| - name: Commit and push changes | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add src/ | |
| git diff --staged --quiet || git commit -m "Update Kaggle notebook in /src/" | |
| git push origin HEAD:main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} |