Skip to content

Weekly sort json

Weekly sort json #149

# yamllint disable rule:line-length
---
name: Weekly sort json
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
sort_json:
if: github.repository_owner == 'alexbelgium'
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- 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: Create New Pull Request If Needed
if: steps.sort.outputs.changed != ''
uses: peter-evans/create-pull-request@v5
with:
title: "Github bot : json sorted"
branch-suffix: timestamp
commit-message: "Github bot : json sorted"