Scrape platform #32
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: "Scrape platform" | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "xingxi/*" | |
schedule: | |
- cron: "0 1 * * 2" | |
permissions: | |
contents: write | |
jobs: | |
Scrape: | |
name: "Scrape platform and convert as Media object" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: "Load secrets, if any" | |
uses: oNaiPs/secrets-to-env-action@v1 | |
with: | |
secrets: ${{ toJson(secrets) }} | |
- name: "Setup python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: "Install dependencies" | |
run: pip install -U -r requirements.txt | |
- name: "Run scraper" | |
shell: pwsh | |
run: | | |
try { | |
python3 xingxi | |
$date = Get-Date -Format "yyyy-MM-dd'T'HH:mm:sszzzz" | |
git config --local user.email "[email protected]" | |
git config --local user.name "Rensetsu[bot]" | |
git add . | |
git commit -m "Scrape data, $date update" | |
git push | |
} | |
catch { | |
"Failed to commit, check logs!" | |
exit 1 | |
} |