Skip to content

Commit 884989e

Browse files
committed
Fix module cleanup batch PR body and threshold corruption from shallow main fetch
1 parent a33fa02 commit 884989e

3 files changed

Lines changed: 35 additions & 33 deletions

File tree

.github/scripts/module-cleanup/finalize.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ SHORT="${SHORT_NAME:?SHORT_NAME required}"
4949
AGENT_RESULT="${AGENT_RESULT:-failure}"
5050
ARTIFACT_DIR="${ARTIFACT_DIR:-./agent-artifact}"
5151

52-
git fetch origin main --depth=1
53-
git fetch origin "$MEMORY_BRANCH" --depth=1 2>/dev/null || true
54-
git fetch origin "$WIP_BRANCH" --depth=1 2>/dev/null || true
52+
# Full history is required for `origin/main..origin/$WIP_BRANCH` log/diff
53+
# below. The finalize job's checkout uses `fetch-depth: 0`, so don't
54+
# re-shallow any of these refs with `--depth`.
55+
git fetch origin main
56+
git fetch origin "$MEMORY_BRANCH" 2>/dev/null || true
57+
git fetch origin "$WIP_BRANCH" 2>/dev/null || true
5558

5659
# ---- 1. Update processed.txt (and failed.txt on failure) ----
5760

@@ -133,7 +136,7 @@ if [ -n "$PATCH_SRC" ]; then
133136
)
134137
fi
135138

136-
git fetch origin "$WIP_BRANCH" --depth=50 2>/dev/null || true
139+
git fetch origin "$WIP_BRANCH" 2>/dev/null || true
137140

138141
# ---- 3. Decide flush ----
139142

.github/workflows/module-cleanup.lock.yml

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

.github/workflows/module-cleanup.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ jobs:
131131
# bodies list the modules under "## Modules in this batch" as
132132
# "- " followed by the short wrapped in backticks). Once a PR
133133
# merges, those shorts also exist in processed.txt so they won't
134-
# be re-picked.
134+
# be re-picked. Only scan the "Modules in this batch" section
135+
# (terminated by `---`) so an unrelated backticked line elsewhere
136+
# in the body cannot poison the processed-set.
135137
inflight=$(gh pr list --repo "$GITHUB_REPOSITORY" \
136138
--label "module cleanup" --state open \
137139
--json body --jq '.[].body' \
140+
| awk '/^## Modules in this batch/{f=1; next} /^---/{f=0} f' \
138141
| sed -n 's/^- `\([^`]*\)`$/\1/p' || true)
139142
export REVIEW_PROGRESS="$(printf '%s\n%s\n' "$processed" "$inflight" \
140143
| grep -v '^$' | sort -u)"
@@ -157,7 +160,11 @@ jobs:
157160
private-key: ${{ secrets.OTELBOT_JAVA_INSTRUMENTATION_PRIVATE_KEY }}
158161
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
159162
with:
160-
fetch-depth: 1
163+
# Full history is required: finalize computes
164+
# `origin/main..origin/module-cleanup-wip` to build the PR body and
165+
# decide whether to flush. With a shallow `origin/main`, main's own
166+
# ancestors leak into that range and corrupt both outputs.
167+
fetch-depth: 0
161168
persist-credentials: true
162169
token: ${{ steps.otelbot-token.outputs.token }}
163170
- name: Configure git author

0 commit comments

Comments
 (0)