Hoyoverse Code Scraper #2296
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: Hoyoverse Code Scraper | |
on: | |
schedule: | |
# Runs every 1 hour | |
- cron: "0 * * * *" | |
workflow_dispatch: | |
jobs: | |
scrape-codes: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.x | |
cache: "pip" | |
- name: install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: run the scraper | |
run: | | |
python main.py | |
- name: commit and push changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
# Check if there are changes | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "update: $(date +'%Y-%m-%d')" | |
git push | |
else | |
echo "No changes to commit" | |
fi |