|
66 | 66 | retention-days: 30 |
67 | 67 |
|
68 | 68 | - name: Comment coverage on PR |
69 | | - if: github.event_name == 'pull_request' && matrix.node-version == 22 |
| 69 | + if: github.event_name == 'pull_request' && matrix.node-version == 22 && github.event.pull_request.head.repo.full_name == github.repository |
70 | 70 | uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
71 | 71 | with: |
72 | 72 | script: | |
|
96 | 96 | .slice(0, limit); |
97 | 97 |
|
98 | 98 | return files; |
99 | | - } // Try to read coverage summary |
| 99 | + } |
| 100 | + // Try to read coverage summary |
100 | 101 | try { |
101 | 102 | const coveragePath = path.join(process.cwd(), 'coverage', 'coverage-summary.json'); |
102 | 103 |
|
@@ -183,10 +184,50 @@ jobs: |
183 | 184 | }); |
184 | 185 | } |
185 | 186 |
|
| 187 | + - name: Skip PR comment for forks (security) |
| 188 | + if: github.event.pull_request.head.repo.full_name != github.repository && matrix.node-version == 22 |
| 189 | + run: | |
| 190 | + echo "ℹ️ Skipping coverage comment for forked PR due to security policy" |
| 191 | + echo "📊 Coverage report is still generated and available in workflow artifacts" |
| 192 | + echo "🔒 This prevents potential information disclosure to external contributors" |
| 193 | +
|
| 194 | + pre-commit: |
| 195 | + name: Pre-commit |
| 196 | + |
| 197 | + runs-on: ubuntu-latest |
| 198 | + |
| 199 | + env: |
| 200 | + PRE_COMMIT_HOME: ${{ github.workspace }}/.pre-commit |
| 201 | + |
| 202 | + steps: |
| 203 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 204 | + |
| 205 | + - name: Cache pre-commit |
| 206 | + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 |
| 207 | + with: |
| 208 | + path: | |
| 209 | + ${{ env.PRE_COMMIT_HOME }} |
| 210 | + key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} |
| 211 | + |
| 212 | + - name: Set up uv |
| 213 | + uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0 |
| 214 | + with: |
| 215 | + enable-cache: true |
| 216 | + cache-suffix: pre-commit |
| 217 | + cache-dependency-glob: '' |
| 218 | + |
| 219 | + - name: Install pre-commit |
| 220 | + run: uv tool install pre-commit |
| 221 | + |
| 222 | + - name: Run pre-commit |
| 223 | + run: pre-commit run --show-diff-on-failure --color=always --all-files |
| 224 | + |
186 | 225 | test-results: |
187 | 226 | if: always() |
188 | 227 | runs-on: ubuntu-latest |
189 | | - needs: test |
| 228 | + needs: |
| 229 | + - test |
| 230 | + - pre-commit |
190 | 231 | steps: |
191 | 232 | - name: Check test results |
192 | 233 | run: | |
|
0 commit comments