@@ -138,7 +138,16 @@ jobs:
138138 { owner, repo, pull_number: prNumber, per_page: 100 }
139139 );
140140 const files = filesRes.map(f => f.filename);
141- const linesChanged = filesRes.reduce((sum, f) => sum + f.additions + f.deletions, 0);
141+ const TEST_FILE_PATTERNS = [
142+ /\/__tests__\//,
143+ /\.test\.[jt]sx?$/,
144+ /\.spec\.[jt]sx?$/,
145+ /^packages\/app\/tests\//,
146+ ];
147+ const isTestFile = f => TEST_FILE_PATTERNS.some(p => p.test(f));
148+ const nonTestFiles = filesRes.filter(f => !isTestFile(f.filename));
149+ const testLines = filesRes.filter(f => isTestFile(f.filename)).reduce((sum, f) => sum + f.additions + f.deletions, 0);
150+ const linesChanged = nonTestFiles.reduce((sum, f) => sum + f.additions + f.deletions, 0);
142151
143152 // Fetch PR metadata
144153 const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: prNumber });
@@ -250,7 +259,7 @@ jobs:
250259 `<details><summary>Stats</summary>`,
251260 '',
252261 `- Files changed: ${files.length}`,
253- `- Lines changed: ${linesChanged}`,
262+ `- Lines changed: ${linesChanged}${testLines > 0 ? ` (+ ${testLines} in test files, excluded from tier calculation)` : ''} `,
254263 `- Branch: \`${branchName}\``,
255264 `- Author: ${author}`,
256265 '',
0 commit comments