Skip to content

Commit

Permalink
Add debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
samjwu committed May 29, 2024
1 parent 13e506c commit 6b37207
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,26 @@ jobs:
- name: Generate suggestions
run: |
echo "[]" > comments.json
echo "Created comments.json"
while IFS= read -r line; do
echo "Processing line: $line"
if [[ "$line" =~ ^@@ ]]; then
# Get file name
echo "Line matches diff hunk header"
file=$(echo "$line" | grep -oP '(?<= b/).*?(?= @@)')
# Get line number
echo "Got file name: $file"
position=$(echo "$line" | grep -oP '(?<=@@ -).*?(?= @@)' | awk '{split($0, a, " "); print a[2]}')
# Generate comment
echo "Got line number: $position"
comment=$(jq -n --arg file "$file" --arg pos "$position" '{path: $file, position: ($pos|tonumber), body: "Please apply the suggested clang-format changes."}')
echo "Generated comment: $comment"
tmp=$(mktemp)
jq ". += [$comment]" comments.json > "$tmp" && mv "$tmp" comments.json
echo "Appended comment to comments.json"
fi
done < clang_format.patch
Expand Down

0 comments on commit 6b37207

Please sign in to comment.