Skip to content

Commit e1e5d87

Browse files
authored
Fix the code review sweep workflow again (#16505)
1 parent 8f0674d commit e1e5d87

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

.github/workflows/code-review-sweep.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,20 @@ jobs:
2727
with:
2828
fetch-depth: 1
2929

30+
- name: Fetch progress branch
31+
run: git fetch origin otelbot/code-review-progress || true
32+
3033
- name: Build review matrix
3134
id: build-matrix
3235
env:
3336
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
REVIEW_PROGRESS: ${{ vars.REVIEW_PROGRESS }}
35-
run: python .github/scripts/build-review-matrix.py
37+
run: |
38+
# Read progress from the dedicated orphan branch (if it exists)
39+
progress=$(git show origin/otelbot/code-review-progress:reviewed.txt 2>/dev/null || true)
40+
if [[ -n "$progress" ]]; then
41+
export REVIEW_PROGRESS="$progress"
42+
fi
43+
python .github/scripts/build-review-matrix.py
3644
3745
# ---------------------------------------------------------------------------
3846
# Job 2: Run copilot review for each module in the matrix
@@ -47,14 +55,16 @@ jobs:
4755
max-parallel: 2 # keep low to avoid Copilot API rate limits
4856
permissions:
4957
contents: write # for git push
50-
variables: write # for gh variable set REVIEW_PROGRESS
5158
env:
5259
MODULE_DIR: ${{ matrix.module_dir }}
5360
SHORT_NAME: ${{ matrix.short_name }}
5461
MODELS: "gpt-5.3-codex claude-sonnet-4.6"
5562
steps:
5663
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5764

65+
- name: Fetch progress branch
66+
run: git fetch origin otelbot/code-review-progress || true
67+
5868
- name: Free disk space
5969
run: .github/scripts/gha-free-disk-space.sh
6070

@@ -149,7 +159,7 @@ jobs:
149159
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
150160

151161
- name: Create PR
152-
if: steps.otelbot-token.outcome == 'success'
162+
if: steps.commit.outputs.pushed == 'true'
153163
env:
154164
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
155165
run: |
@@ -171,11 +181,21 @@ jobs:
171181
env:
172182
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173183
run: |
174-
# Read current progress, append this module, and save back
175-
current="${{ vars.REVIEW_PROGRESS }}"
184+
# Read current progress from the orphan branch
185+
current=$(git show origin/otelbot/code-review-progress:reviewed.txt 2>/dev/null || true)
176186
if [[ -n "$current" ]]; then
177187
updated=$(printf '%s\n%s' "$current" "$SHORT_NAME" | tr ',' '\n' | sort -u | paste -sd ',')
178188
else
179189
updated="$SHORT_NAME"
180190
fi
181-
gh variable set REVIEW_PROGRESS --body "$updated"
191+
192+
# Write to the orphan branch
193+
blob=$(echo "$updated" | git hash-object -w --stdin)
194+
tree=$(printf '100644 blob %s\treviewed.txt\n' "$blob" | git mktree)
195+
parent=$(git rev-parse --verify origin/otelbot/code-review-progress 2>/dev/null || true)
196+
if [[ -n "$parent" ]]; then
197+
commit=$(git commit-tree "$tree" -p "$parent" -m "Mark $SHORT_NAME as reviewed")
198+
else
199+
commit=$(git commit-tree "$tree" -m "Mark $SHORT_NAME as reviewed")
200+
fi
201+
git push origin "$commit:refs/heads/otelbot/code-review-progress"

0 commit comments

Comments
 (0)