chore(ci): Update workflow to use Ubuntu 22.04 and improve JSON formatting

This commit is contained in:
2025-01-24 01:43:42 +07:00
parent 5c5970cd03
commit f5d2657827

View File

@@ -5,7 +5,7 @@ on: [push, pull_request, workflow_dispatch]
jobs: jobs:
validate: validate:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
@@ -36,7 +36,7 @@ jobs:
format: format:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
needs: validate needs: validate
@@ -57,11 +57,14 @@ jobs:
run: npm install --global prettier sort-json run: npm install --global prettier sort-json
- name: Run Prettier - name: Run Prettier
run: prettier --write "local-files/*.json" "local-files/genericTrans/index/*.json" "local-files/genericTrans/lyrics/*.json" run: prettier --write "local-files/genericTrans/index/*.json" "local-files/genericTrans/lyrics/*.json" "local-files/generic.json" "local-files/localization.json"
# Do not ever sort lyrics alphabetically...
- name: Sort JSON files - name: Sort JSON files
run: find local-files -type f -name '*.json' -not -path "local-files/genericTrans/*" -not -path "local-files/masterTrans/*" -exec sort-json {} + run: |
find local-files/genericTrans/index -type f -exec sort-json {} +
sort-json local-files/generic.json
sort-json local-files/localization.json
- name: Authorize Git - name: Authorize Git
run: | run: |
@@ -70,8 +73,7 @@ jobs:
- name: Commit Changes - name: Commit Changes
run: | run: |
git add local-files/*.json local-files/**/*.json git commit -am "chore(format): Format and Sort JSON files"
git commit -m "chore(format): Format and Sort JSON files"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then if [[ "${{ github.event_name }}" == "pull_request" ]]; then
git push origin HEAD:${{ github.head_ref }} git push origin HEAD:${{ github.head_ref }}
else else
@@ -83,7 +85,7 @@ jobs:
update: update:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
needs: [validate, format] needs: [validate, format]