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