Update Live Scores #819
This file contains 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 Live Scores | |
on: | |
schedule: | |
- cron: '0 1 * * *' # Runs every day at 1 AM UTC | |
workflow_dispatch: # Allows manual trigger of the workflow | |
jobs: | |
update-scores: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # Use the default GitHub token | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git config pull.rebase false # Set to merge | |
- name: Force pull latest changes | |
run: | | |
git fetch origin | |
git reset --hard origin/main # Adjust if your default branch is different | |
git clean -fd | |
- name: List directory contents | |
run: | | |
ls -la | |
ls -la scripts || echo "Scripts directory not found." | |
- name: Run script | |
run: | | |
python scripts/transfermarkt_github.py | |
- name: Commit changes | |
run: | | |
git add . | |
git commit -m "Update live scores for $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes to commit" | |
git push origin main || echo "Failed to push changes" # Adjust if your default branch is different |