name: Run Scraper on: schedule: - cron: "0 */15 * * *" # Every 15 minutes workflow_dispatch: push: paths: - "scrape.py" - ".github/workflows/main.yml" jobs: scrape: runs-on: ubuntu-slim steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install uv id: setup-uv uses: astral-sh/setup-uv@v4 - name: Install dependencies run: uv sync --all-groups -U - name: Run script run: uv run python scrape.py - name: Stage any changes from scraper run: | git add -A - name: Pull latest changes with rebase run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" # If there are staged changes, commit them temporarily if ! git diff --cached --quiet; then git commit -m "Temporary commit for rebase" git pull --rebase https://${{ secrets.GITHUB_TOKEN }}@github.com/TheLovinator1/wutheringwaves.git master # Reset to unstage the temporary commit but keep the changes git reset --soft HEAD~1 else git pull --rebase https://${{ secrets.GITHUB_TOKEN }}@github.com/TheLovinator1/wutheringwaves.git master fi - name: Get the files that will be committed id: get_modified_files run: | files=$(git diff --cached --name-only | xargs | sed 's/ /, /g') echo "files=$files" >> $GITHUB_OUTPUT - name: Commit and push changes run: | # Check if there are any staged changes if git diff --cached --quiet; then echo "No changes to commit" else git commit -m "Updated files: ${{ steps.get_modified_files.outputs.files }}" git push https://${{ secrets.GITHUB_TOKEN }}@github.com/TheLovinator1/wutheringwaves.git HEAD:master fi