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