Skip to content

Commit

Permalink
[CI] Ensure specified version of Prettier is run in workflow (open-te…
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Dec 13, 2024
1 parent 0b9b3bc commit 9620def
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ jobs:
- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
jq '{devDependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json

- name: Check file format
run: npm run check:format --ignore-scripts
- name: Install package(s)
run: |
PRETTIER_AT_VERS=@$(npm pkg get devDependencies.prettier | tr -d '^"')
echo "PRETTIER_AT_VERS=$PRETTIER_AT_VERS" | tee -a $GITHUB_ENV
npm install prettier$PRETTIER_AT_VERS --no-save
set -x && npx prettier --version
- run: npm run check:format
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"scripts": {
"__check:links": "make --keep-going check-links",
"_build": "npm run _hugo -- -e dev --buildDrafts --baseURL \"${DEPLOY_PRIME_URL:-http://localhost}\"",
"_check:format:any": "npx prettier --check --ignore-path ''",
"__check:format": "npx prettier${PRETTIER_AT_VERS}",
"_check:format:any": "npm run __check:format -- --check --ignore-path ''",
"_check:format:ja+zh": "npm run _check:format:nowrap -- content/ja content/zh",
"_check:format:nowrap": "npm run _check:format:any -- --prose-wrap preserve",
"_check:format": "npx prettier --check .",
"_check:format": "npm run __check:format -- --check .",
"_check:links--md": "npx markdown-link-check --config .markdown-link-check.json *.md",
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
"_check:links:internal": "npm run __check:links",
Expand Down Expand Up @@ -120,7 +121,7 @@
"markdown-link-check": "^3.13.6",
"markdownlint": "^0.36.1",
"postcss-cli": "^11.0.0",
"prettier": "^3.4.2",
"prettier": "3.4.2",
"require-dir": "^1.2.0",
"textlint": "^14.4.0",
"textlint-filter-rule-allowlist": "^4.0.0",
Expand Down

0 comments on commit 9620def

Please sign in to comment.