chore(dispatch.yml): update workflow to install dependencies and format/sort JSON files

fix(dispatch.yml): fix prettier and sort-json installation commands
chore(dispatch.yml): update commit message to reflect formatting and sorting of JSON files
This commit is contained in:
2024-07-01 11:12:20 +07:00
parent bfbf3d6d43
commit e42eb74a58

View File

@@ -54,18 +54,14 @@ jobs:
with: with:
node-version: '18' node-version: '18'
- name: Install Prettier and JSON Sort Plugin - name: Install Dependencies
run: npm install --global prettier prettier-plugin-sort-json run: npm install --global prettier sort-json
- name: Create Prettier Configuration - name: Run Prettier
run: | run: prettier --write "local-files/**/*.json"
echo '{
"plugins": ["prettier-plugin-sort-json"],
"jsonRecursiveSort": true
}' > .prettierrc.json
- name: Run Prettier to format JSON files - name: Sort JSON files
run: prettier --plugin-search-dir "$(npm root -g)" --write "local-files/**/*.json" run: find local-files -type f -name '*.json' -exec sort-json {} \;
- name: Authorize Git - name: Authorize Git
run: | run: |
@@ -75,7 +71,7 @@ jobs:
- name: Commit Changes - name: Commit Changes
run: | run: |
git add local-files/**/*.json git add local-files/**/*.json
git commit -m "chore(format): Format JSON files with Prettier" git commit -m "chore(format): Format and Sort JSON files"
git push origin main git push origin main
env: env:
GITHUB_TOKEN: ${{ secrets.PAT }} GITHUB_TOKEN: ${{ secrets.PAT }}