ci: fix Windows deps - use npm install --force #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: sofagent-audit | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: cd sofagent/audit && npm ci | |
| - name: Build | |
| run: cd sofagent/audit && npm run build | |
| - name: Run audit | |
| # exit 0=PASS / 1=WARN / 2=FAIL | |
| # CI 只阻断 FAIL(exit 2),WARN(exit 1)只提醒不阻断 | |
| run: | | |
| cd sofagent/audit && npx sofagent-audit --silent --diff HEAD~1..HEAD --ci | |
| exit_code=$? | |
| if [ $exit_code -eq 2 ]; then | |
| echo "❌ FAIL: 审计发现违规" | |
| exit 1 | |
| elif [ $exit_code -eq 1 ]; then | |
| echo "⚠️ WARN: 审计有警告,请确认但不阻断 CI" | |
| exit 0 | |
| else | |
| echo "✅ PASS: 审计全通过" | |
| fi |