Skip to content

Commit 6a9ad80

Browse files
Add GitHub Action workflow for PR line counting
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
1 parent 3eb8dbc commit 6a9ad80

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PR Line Counter
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
count-lines:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Count lines in generate_sweep_configs.py
16+
id: line-count
17+
run: |
18+
FILE_PATH="utils/matrix-logic/generate_sweep_configs.py"
19+
20+
if [ -f "$FILE_PATH" ]; then
21+
LINE_COUNT=$(wc -l < "$FILE_PATH")
22+
echo "line_count=$LINE_COUNT" >> $GITHUB_OUTPUT
23+
echo "file_exists=true" >> $GITHUB_OUTPUT
24+
else
25+
echo "file_exists=false" >> $GITHUB_OUTPUT
26+
echo "line_count=0" >> $GITHUB_OUTPUT
27+
fi
28+
29+
- name: Generate summary
30+
run: |
31+
echo "## 📊 Line Count Report" >> $GITHUB_STEP_SUMMARY
32+
echo "" >> $GITHUB_STEP_SUMMARY
33+
34+
FILE_EXISTS="${{ steps.line-count.outputs.file_exists }}"
35+
if [ "$FILE_EXISTS" == "true" ]; then
36+
FILE_PATH="utils/matrix-logic/generate_sweep_configs.py"
37+
LINE_COUNT="${{ steps.line-count.outputs.line_count }}"
38+
echo "**File:** \`$FILE_PATH\`" >> $GITHUB_STEP_SUMMARY
39+
echo "" >> $GITHUB_STEP_SUMMARY
40+
echo "**Total Lines:** $LINE_COUNT" >> $GITHUB_STEP_SUMMARY
41+
else
42+
FILE_PATH="utils/matrix-logic/generate_sweep_configs.py"
43+
echo "⚠️ **File not found:** \`$FILE_PATH\`" >> $GITHUB_STEP_SUMMARY
44+
fi

0 commit comments

Comments
 (0)