From f21f673574ff5b372b0d1c4c5f96ecffbfb6792c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Fri, 16 May 2025 01:36:33 +0200 Subject: [PATCH] Migrate scraper workflow to Gitea --- .gitea/workflows/main.yml | 47 ++++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 39 ------------------------------- 2 files changed, 47 insertions(+), 39 deletions(-) create mode 100644 .gitea/workflows/main.yml delete mode 100644 .github/workflows/main.yml diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml new file mode 100644 index 0000000..b6b9b2a --- /dev/null +++ b/.gitea/workflows/main.yml @@ -0,0 +1,47 @@ +name: Run Scraper + +on: + schedule: + - cron: '0 * * * *' # Every hour + workflow_dispatch: + +jobs: + scrape: + runs-on: ubuntu-latest + steps: + - name: Check for required secret + run: | + if [ -z "${{ secrets.REPO_WRITE_PAT }}" ]; then + echo "Missing REPO_WRITE_PAT secret. Aborting." + exit 1 + fi + - name: Checkout code + uses: https://github.com/actions/checkout@v4 + + - name: Set up Python + uses: https://github.com/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 + + - 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 + + - name: Commit and push changes + run: | + git config user.name "Joakim Hellsén" + git config user.email "tlovinator@gmail.com" + git add . + git commit -m "Updated files: ${{ steps.get_modified_files.outputs.files }}" || echo "No changes to commit" + git push https://${{ secrets.REPO_WRITE_PAT }}@git.lovinator.space/TheLovinator/wutheringwaves.git HEAD:main diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index c2876af..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -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 - - - 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 }}"