From 347e1a14ffb84ac1357e52fef3a1bf88528cbed4 Mon Sep 17 00:00:00 2001 From: PeterCJ Date: Wed, 11 Feb 2026 10:11:15 -0800 Subject: [PATCH] Add a step to sort the JSON (only on workflow_dispatch or when pushing to main) --- .github/workflows/CI_build.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/CI_build.yml b/.github/workflows/CI_build.yml index d3dd5c2..72b5ce5 100644 --- a/.github/workflows/CI_build.yml +++ b/.github/workflows/CI_build.yml @@ -50,6 +50,25 @@ jobs: # since AC may have been added to JSON, need to revalidate JSON and re-generate md python .validators\validator_json.py --output-md + - name: ⇅ Sort JSON + working-directory: . + if: ${{ contains('push workflow_dispatch', github.event_name) && github.ref == 'refs/heads/master' && github.repository == 'notepad-plus-plus/userDefinedLanguages' }} + run: | + # sort JSON back into string + $file = "udl-list.json" + $a = Get-Content $file | ConvertFrom-Json + $a.'UDLs' = $a.'UDLs' | sort -Property 'id-name' + $content = $a | ConvertTo-Json -Depth 5 + # + # reformat JSON + $content = $content -replace ': ', ": " + $content = $content -replace ' ', " " + $content = $content -replace ' ', " " + $content = $content -replace ' ', " " + # + # save sorted JSON text + $content > $file + - name: 🎉 Update repo with automated changes for the UDL list and autoCompletions uses: stefanzweifel/git-auto-commit-action@v7 if: contains('push workflow_dispatch', github.event_name)