Compare commits

..

1 Commits

Author SHA1 Message Date
dd785e83a3 Fixing timing test runner
All checks were successful
Merge-Checker / Benchmarking (pull_request) Successful in 22s
Merge-Checker / build_and_test (pull_request) Successful in 19s
2025-05-29 16:26:05 -04:00

View File

@@ -93,32 +93,35 @@ jobs:
echo "timings_changed=false" >> $GITHUB_OUTPUT echo "timings_changed=false" >> $GITHUB_OUTPUT
fi fi
- name: Leave PR comment with timing updates - name: Commit and push timing results
if: steps.check_diff.outputs.timings_changed == 'true' if: steps.check_diff.outputs.timings_changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
echo "Preparing PR comment with new timing results..." git config --global user.name "ci-bot"
git config --global user.email "ci-bot@local"
COMMENT_BODY=$(echo -e "### ⏱ Timing Results Changed\n\n" \ BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
"The benchmark detected significant timing changes (≥ 0.1s).\n\n" \ git stash
"**Please review and commit the updated timing results** to:\n\`\`\`\nunit-tests/timing-results/matrix-timing-tests.txt\n\`\`\`\n\n" \ echo "Checking out source branch $BRANCH_NAME"
"Latest result:\n\`\`\`\n$(cat unit-tests/timing-results/matrix-timing-tests.txt)\n\`\`\`\n\n" \ git fetch origin "$BRANCH_NAME"
"<!-- timing-bot-comment -->") git checkout "$BRANCH_NAME"
git pull
PR_NUMBER="${{ github.event.pull_request.number }}" echo "Checking if last commit was a timing update"
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
# Look for an existing bot comment if echo "$LAST_COMMIT_MSG" | grep -q "Update matrix-timing-tests timings"; then
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${PR_NUMBER}/comments \ echo "Last commit was a timing update, skipping commit."
--jq '.[] | select(.body | contains("<!-- timing-bot-comment -->")) | .id') exit 0
if [ -z "$COMMENT_ID" ]; then
echo "Creating new PR comment"
gh api repos/${{ github.repository }}/issues/${PR_NUMBER}/comments \
-f body="$COMMENT_BODY"
else else
echo "Updating existing PR comment" echo "Last commit name was: $LAST_COMMIT_MSG"
gh api repos/${{ github.repository }}/issues/comments/${COMMENT_ID} \ git stash pop
-X PATCH -F body="$COMMENT_BODY"
fi fi
git add unit-tests/timing-results/matrix-timing-tests.txt
if git diff --quiet --cached; then
echo "No changes to commit"
else
git commit -m "Update matrix-timing-tests timings"
git push origin "$BRANCH_NAME"
fi