From 1479eecba4668ae7f13ab2305b19731db890dfa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= <tlovinator@gmail.com> Date: Thu, 15 May 2025 04:26:29 +0200 Subject: [PATCH] Add GitHub Actions workflow to run scraper on schedule --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cd952df --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +name: Run Scraper + +on: + schedule: + - cron: '0 * * * *' # Every hour + workflow_dispatch: + +jobs: + scrape: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Install dependencies + run: uv sync --system + + - name: Run script + run: uv run python scrape.py + + - name: Get the modified files + id: get_modified_files + run: | + files=$(git diff --name-only HEAD^ HEAD | xargs | sed 's/ /, /g') + echo "files=$files" >> $GITHUB_OUTPUT + + - uses: EndBug/add-and-commit@v9 + with: + author_name: Joakim Hellsén + author_email: tlovinator@gmail.com + message: "Updated files: ${{ steps.get_modified_files.outputs.files }}"