Files
hassio-addons/.github/workflows/weekly_sortjson.yaml
2023-01-08 20:36:39 +01:00

31 lines
745 B
YAML

# yamllint disable rule:line-length
---
name: Weekly sort json
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
sort_json:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run script file
id: sort
run: |
for files in */*.json; do
echo "Sorting $files"
jq --sort-keys . "$files" > config2.json && cat config2.json > "$files" && rm config2.json
echo "changed=1" >> "$GITHUB_OUTPUT"
done
shell: bash
- name: Commit if needed
if: steps.sort.outputs.changed != ''
uses: EndBug/add-and-commit@v9
with:
message: "Github bot : json sorted"
default_author: github_actions