Skip to content

Check JSON Files #23387

Check JSON Files

Check JSON Files #23387

Workflow file for this run

name: Check JSON Files
on:
workflow_dispatch:
schedule:
- cron: "*/15 * * * *"
jobs:
compare-json:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run Python script <=2.0.1
run: python ./script/update_json.py
- name: Run Python script >= 2.1
run: python ./v2/update_json.py
- name: Set up Git
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Compare JSON files
id: compare
run: |
if ! cmp -s ./v2/cardputer.json ./v2/tmp/cardputer.json || ! cmp -s ./v2/stickc.json ./v2/tmp/stickc.json || ! cmp -s ./v2/core2.json './v2/tmp/core2 & tough.json' || ! cmp -s ./v2/core.json ./v2/tmp/core.json || ! cmp -s ./v2/cores3.json ./v2/tmp/cores3.json || ! cmp -s ./v2/third_party.json './v2/tmp/third party.json'; then
echo "Files are different. Updating..."
rm -f ./cardputer.json ./stickc.json ./core2.json ./core.json
cp ./script/cardputer.json ./script/stickc.json ./script/core.json ./
cp './script/core2 & tough.json' ./core2.json
rm -f ./test/cardputer.json
cp ./script/cardputer.json ./test/
rm -f ./v2/cardputer.json ./v2/stickc.json ./v2/core2.json ./v2/core.json ./v2/cores3.json .v2/third_party.json
cp ./v2/tmp/cardputer.json ./v2/tmp/stickc.json ./v2/tmp/core.json ./v2/tmp/cores3.json ./v2/
cp './v2/tmp/core2 & tough.json' ./v2/core2.json
cp './v2/tmp/third party.json' ./v2/third_party.json
git add .
git commit -m "Update JSON files"
git push
else
echo "Files are the same. Workflow terminated."
fi