@@ -189,6 +189,54 @@ jobs:
189189
190190 echo "Successfully pushed benchmark results to branch ${{ github.head_ref || github.ref_name }}"
191191
192+ # Weight diff for full bench runs. The standalone weight-diff workflow
193+ # can't trigger off the bot's push (GITHUB_TOKEN does not retrigger
194+ # workflows), so we compute and post the diff here instead. Both writers
195+ # use the same `weight-diff` sticky header, so this overwrites the
196+ # last comment from the standalone workflow.
197+ - name : Materialize master weights for weight-diff
198+ if : steps.prepare.outputs.benchmark_type == 'full'
199+ run : |
200+ git fetch --no-tags --depth=1 origin master:refs/remotes/origin/master
201+ mkdir -p /tmp/weights-master/runtime/hydradx/src/weights
202+ git archive origin/master runtime/hydradx/src/weights 2>/dev/null \
203+ | tar -x -C /tmp/weights-master || true
204+
205+ - name : Generate weight diff report
206+ if : steps.prepare.outputs.benchmark_type == 'full'
207+ id : weight-diff
208+ run : |
209+ set -euo pipefail
210+ python3 scripts/weight-diff/weight_diff.py \
211+ --old /tmp/weights-master/runtime/hydradx/src/weights \
212+ --new runtime/hydradx/src/weights \
213+ > weight-diff-report.md
214+
215+ if grep -q 'No weight changes detected' weight-diff-report.md; then
216+ echo "has_changes=false" >> "$GITHUB_OUTPUT"
217+ else
218+ echo "has_changes=true" >> "$GITHUB_OUTPUT"
219+ fi
220+
221+ echo "----- report preview -----"
222+ head -40 weight-diff-report.md
223+
224+ - name : Post weight-diff comment after full bench
225+ if : steps.prepare.outputs.benchmark_type == 'full' && steps.weight-diff.outputs.has_changes == 'true'
226+ uses : marocchino/sticky-pull-request-comment@v2.1.0
227+ with :
228+ header : weight-diff
229+ path : weight-diff-report.md
230+ number : ${{ steps.prepare.outputs.pr_number }}
231+
232+ - name : Remove stale weight-diff comment after full bench (no changes)
233+ if : steps.prepare.outputs.benchmark_type == 'full' && steps.weight-diff.outputs.has_changes == 'false'
234+ uses : marocchino/sticky-pull-request-comment@v2.1.0
235+ with :
236+ header : weight-diff
237+ delete : true
238+ number : ${{ steps.prepare.outputs.pr_number }}
239+
192240 - name : Comment benchmark results to the pull request
193241 if : github.event_name == 'pull_request'
194242 uses : marocchino/sticky-pull-request-comment@v2.1.0
0 commit comments