-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.72 KB
/
030_gen_json.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 }}