Skip to content

Fetch Steam Prices

Fetch Steam Prices #56

name: Fetch Steam Prices
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
fetch_prices:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Enable sparse-checkout
run: |
git config core.sparseCheckout true
echo "/fetch_steam_prices.py" >> .git/info/sparse-checkout
echo "/price_standalone.json" >> .git/info/sparse-checkout
git read-tree -mu HEAD
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install aiohttp
- name: Run Steam price fetcher script
run: |
python fetch_steam_prices.py
- name: Check if price_standalone.json has changed
run: |
if [ -f price_standalone.json ]; then
echo "File exists, creating backup..."
cp price_standalone.json price_standalone.json.bak
else
echo "File does not exist, creating new file"
fi
- name: Commit and push price_standalone.json if changed
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"
git add price_standalone.json
git diff --cached --exit-code || (
git commit -m "Update price_standalone.json with latest prices"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/moshiax/priceinautomata.git
)