Skip to content

Commit 97cd421

Browse files
committed
fix: address code review findings from CR session
- H-1: revert yarn cache strategy to actions/cache@v4 + hashFiles package.json since yarn.lock is gitignored; cache: yarn requires yarn.lock to generate a stable cache key - H-2: add fetch-depth: 0 to sync-catalog.yml checkout step to ensure git-auto-commit-action@v5 works correctly on workflow_dispatch - M-1: fix DEVELOPMENT.md cache description to match actual ci.yml impl - M-2: change lychee upload-artifact if: always() to if: failure() to avoid spurious warnings when no broken links are found
1 parent e2e4841 commit 97cd421

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060

6161
- name: Upload lychee results
6262
uses: actions/upload-artifact@v4
63-
if: always()
63+
if: failure()
6464
with:
6565
name: lychee-report
6666
path: lychee/out.md
@@ -77,7 +77,14 @@ jobs:
7777
- uses: actions/setup-node@v4
7878
with:
7979
node-version: 20
80-
cache: 'yarn'
80+
81+
- name: Cache node_modules
82+
uses: actions/cache@v4
83+
with:
84+
path: node_modules
85+
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
86+
restore-keys: |
87+
${{ runner.os }}-node-
8188
8289
- name: Docusaurus build
8390
run: |

.github/workflows/sync-catalog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1820

1921
- name: Setup Python
2022
uses: actions/setup-python@v5

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ yarn run write-translations -- --locale zh-cn
4040
yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest
4141
```
4242

43-
> **注意**`yarn.lock` 已在 `.gitignore` 中,**不提交**。CI 使用 `package.json` hash 作为缓存键
43+
> **注意**`yarn.lock` 已在 `.gitignore` 中,**不提交**。CI 通过 `actions/cache@v4` + `hashFiles('**/package.json')` 缓存 `node_modules/`
4444
4545
---
4646

0 commit comments

Comments
 (0)