Skip to content

Commit b5e3048

Browse files
authored
chore: refine security-guard diff truncation handling
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/9a210269-8ac9-41e3-919f-856a1265a617
1 parent a1ee146 commit b5e3048

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/security-guard.lock.yml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/security-guard.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ steps:
3232
if: github.event.pull_request.number
3333
run: |
3434
DELIM="GHAW_PR_FILES_$(date +%s)"
35+
DIFF_LIMIT=5000
3536
DIFF_TMP="$(mktemp)"
3637
{
3738
echo "PR_FILES<<${DELIM}"
3839
gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}/files" \
3940
--paginate --jq '.[] | "### " + .filename + " (+" + (.additions|tostring) + "/-" + (.deletions|tostring) + ")\n" + (.patch // "") + "\n"' \
4041
> "$DIFF_TMP" || true
4142
DIFF_SIZE="$(wc -c < "$DIFF_TMP" | tr -d ' ')"
42-
head -c 5000 "$DIFF_TMP" || true
43-
if [ "$DIFF_SIZE" -gt 5000 ]; then
44-
echo -e "\n[DIFF TRUNCATED at 5000 chars — use get_file_contents for full context]"
43+
head -c "$DIFF_LIMIT" "$DIFF_TMP" || true
44+
if [ "$DIFF_SIZE" -gt "$DIFF_LIMIT" ]; then
45+
echo -e "\n[DIFF TRUNCATED at ${DIFF_LIMIT} bytes — use get_file_contents for full context]"
4546
fi
4647
echo ""
4748
echo "${DELIM}"

0 commit comments

Comments
 (0)