Build JSON data files #20112
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: Build JSON data files | |
on: | |
schedule: | |
- cron: '48 */2 * * *' | |
push: | |
branches: | |
- '**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
- uses: actions/cache@v3 | |
name: Configure PIP caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Generate JSON content | |
run: bash ./gen_json.sh | |
env: | |
TRACE: 1 | |
GH_TOKEN: ${{ github.token }} | |
- name: Commit and push if there are changes | |
run: |- | |
git diff | |
git config --global user.email "[email protected]" | |
git config --global user.name "bot" | |
git diff --quiet || (git add *.json && git commit -m "Updated data") | |
git pull -r | |
git push | |
priviledged: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- run: bash ./gen_json_privileged.sh | |
env: | |
GH_TOKEN: ${{ secrets.TOKEN_ADMINI }} | |
- name: Commit and push if there are changes | |
run: |- | |
git diff | |
git config --global user.email "[email protected]" | |
git config --global user.name "bot" | |
git diff --quiet || (git add nvim/*.json && git commit -m "Updated data") | |
git pull -r | |
git push |