Skip to content

fix(ci): update committer benchmark comment #6360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions .github/workflows/committer_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,34 @@ jobs:

- run: echo BENCHES_RESULT=$(cat bench_new.txt) >> $GITHUB_ENV

# Post comment in case of performance regression or improvement.
- run: npm install fs
- if: contains(env.BENCHES_RESULT, 'regressed') || contains(env.BENCHES_RESULT, 'improved')
uses: actions/github-script@v6
# Comment with a link to the workflow (or update existing comment on rerun).
- name: Find Comment
if: github.event_name == 'pull_request'
uses: starkware-libs/find-comment@v3
id: find-benchmark-comment
with:
script: |
const fs = require('fs')
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: fs.readFileSync('bench_new.txt', 'utf8'),
path: 'Commits'
})
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Benchmark movements

- name: Create comment
# If the PR number is found and the comment is not found, create a new comment.
if: github.event_name == 'pull_request'
&& steps.find-benchmark-comment.outputs.comment-id == ''
uses: starkware-libs/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ env.BENCHES_RESULT }}

- name: Update comment
# If the PR number is found and the comment exists, update it.
if: github.event_name == 'pull_request'
&& steps.find-benchmark-comment.outputs.comment-id != ''
uses: starkware-libs/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find-benchmark-comment.outputs.comment-id }}
edit-mode: replace
body: ${{ env.BENCHES_RESULT }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cat ${benchmarks_list} |
done

# Prepare the results for posting comment.
echo "Benchmark movements:" > ${benchmark_results}
echo "Benchmark movements: " > ${benchmark_results}
cat ${benchmarks_list} |
while read line; do
if grep -q "regressed" ${line}.txt; then
Expand All @@ -24,3 +24,6 @@ cat ${benchmarks_list} |
cat ${line}.txt >> ${benchmark_results};
fi;
done
if ! (grep -q "regressed" ${benchmark_results} || grep -q "improved" ${benchmark_results}); then
echo "No major performance changes detected." >> ${benchmark_results};
fi
Loading