Skip to content

Commit 2c8f2c7

Browse files
ncreatedclaude
andauthored
Fix shadow reviewer cross-references and depth limits (#4455)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 65cb22a commit 2c8f2c7

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/shadow-review.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ jobs:
7474
7575
# Clone source repo and fetch PR ref
7676
echo "Cloning source repo..."
77-
git clone --depth=1 --no-checkout "https://x-access-token:${GITHUB_TOKEN}@github.com/${SOURCE_REPO}.git" "${WORK_DIR}/repo"
77+
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@github.com/${SOURCE_REPO}.git" "${WORK_DIR}/repo"
7878
cd "${WORK_DIR}/repo"
7979
echo "Fetching PR head..."
80-
git fetch origin "pull/${PR_NUMBER}/head:pr-head" --depth=50
80+
git fetch origin "pull/${PR_NUMBER}/head:pr-head"
8181
echo "Fetching base ref..."
82-
git fetch origin "${PR_BASE_REF}:base-ref" --depth=50
82+
git fetch origin "${PR_BASE_REF}:base-ref"
8383
8484
# Compute merge base
8585
MERGE_BASE=$(git merge-base pr-head base-ref)
@@ -101,22 +101,25 @@ jobs:
101101
git push shadow "${PR_HEAD_SHA}:refs/heads/${SHADOW_BRANCH}" 2>&1
102102
103103
# Create shadow PR
104+
# Escape #123-style references to prevent GitHub cross-linking
105+
ESCAPED_PR_BODY=$(echo "${PR_BODY}" | sed -E 's/#([0-9]+)/`#\1`/g')
106+
104107
echo "Creating shadow PR..."
105108
SHADOW_PR_URL=$(GITHUB_TOKEN="${SHADOW_FORK_TOKEN}" gh pr create \
106109
--repo "${SHADOW_FORK}" \
107110
--base "${BASE_BRANCH}" \
108111
--head "${SHADOW_BRANCH}" \
109112
--title "Shadow: ${PR_TITLE} (v${VERSION})" \
110-
--body "## Shadow Review — PR #${PR_NUMBER} v${VERSION}
113+
--body "## Shadow Review — PR \`#${PR_NUMBER}\` v${VERSION}
111114
112-
**Source:** https://github.com/${SOURCE_REPO}/pull/${PR_NUMBER}
115+
**Source:** \`${SOURCE_REPO}#${PR_NUMBER}\`
113116
**Commit:** \`${PR_HEAD_SHA}\`
114117
**Timestamp:** $(date -u +%Y-%m-%dT%H:%M:%SZ)
115118
116119
---
117120
118121
## Original PR Description
119122
120-
${PR_BODY}")
123+
${ESCAPED_PR_BODY}")
121124
122125
echo "Shadow PR created: ${SHADOW_PR_URL}"

0 commit comments

Comments
 (0)