Add line diff tracking to PR line counter workflow#165
Conversation
📊 Line Count ReportFile: Total Lines: 956 Base Lines: 956 Change: No change ➡️ |
1 similar comment
📊 Line Count ReportFile: Total Lines: 956 Base Lines: 956 Change: No change ➡️ |
There was a problem hiding this comment.
Pull Request Overview
This PR extends the PR line counter workflow to track and display line differences between the PR branch and the base branch. It adds functionality to fetch the base branch version of the target file, calculate the difference in line counts, and display this information with visual indicators.
- Adds base branch file fetching and line counting capability
- Calculates and displays line differences with directional indicators (📈/📉/➡️)
- Handles new files by showing "0 (new file)" for base count
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| BASE_FILE_TMP=$(mktemp) | ||
| if git show "origin/$BASE_REF:$TARGET_FILE" > "$BASE_FILE_TMP" 2>/dev/null; then |
There was a problem hiding this comment.
The temporary file is created unconditionally but only cleaned up inside conditional branches. If the script exits unexpectedly between line 44 and the cleanup points (lines 53, 59), the temporary file will leak. Consider using a trap to ensure cleanup or move mktemp inside the conditional after verifying the file exists.
There was a problem hiding this comment.
Added a trap to ensure the temporary file is cleaned up on exit, even if the script exits unexpectedly. The trap automatically handles cleanup, so the manual rm -f calls have been removed. Fixed in commit ab2df03.
📊 Line Count ReportFile: Total Lines: 956 Base Lines: 956 Change: No change ➡️ |
📊 Line Count ReportFile: Total Lines: 956 Base Lines: 956 Change: No change ➡️ |
1 similar comment
📊 Line Count ReportFile: Total Lines: 956 Base Lines: 956 Change: No change ➡️ |
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
…dling Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
ab2df03 to
bfe7e97
Compare
📊 Line Count ReportFile: Total Lines: 956 Base Lines: 956 Change: No change ➡️ |
Extends the PR line counter workflow to calculate and display line changes between PR and base branches.
Changes
mktempfor temporary files to avoid conflicts in parallel workflow runsExample Output
Existing file modified:
New file added:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.