Skip to content

JSON Generation

JSON Generation #369

Workflow file for this run

name: JSON Generation
on:
workflow_run:
workflows: ["DB Update","DB Update Daily"]
types:
- completed
jobs:
json_gen:
runs-on: ubuntu-latest
steps:
- name: Check the previous workflow
run: |
if [ ${{ github.event.workflow_run.conclusion == 'success' }} ]; then
echo "Previous workflow OK"
else
echo "Previous workflow in error"
exit 1
fi
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
cache: 'pip'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run JSON generation scripts
run: |
echo "Working Directory: $(pwd)"
echo "Files in Current Directory: $(ls -al)"
python scripts/030_JSON_Generation/031_Generate_Rankings_History_JSON.py
python scripts/030_JSON_Generation/032_Generate_Latest_Rankings_JSON.py
python scripts/030_JSON_Generation/033_Generate_Matches_JSON.py
- name: Commit changes
run: |
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USERNAME }}"
if git diff --quiet -- data/json/; then
echo "No changes in data/json directory. Skipping commit."
else
git add -A data/json
git commit -m "Update data/json"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}