Skip to content

Commit

Permalink
ci: fix CTest bot
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmacha committed Jun 18, 2024
1 parent 28a2081 commit 2daff87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/build-ctest-review.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module.exports = async ({github, context, status, log}) => {
module.exports = async ({github, context, pull_number, status, log}) => {
const reviews = await github.rest.pulls.listReviews({
pull_number: context.pull.number,
pull_number: pull_number,
owner: context.repo.owner,
repo: context.repo.repo,
});

reviews.find(r => r.user.login ==='github-actions' && r.state === 'COMMENTED').forEach(r => {
github.rest.pulls.dismissReview({
pull_number: context.pull.number,
pull_number: pull_number,
owner: context.repo.owner,
repo: context.repo.repo,
review_id: r.id
});
});

github.rest.pulls.createReview({
pull_number: context.pull.number,
pull_number: pull_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: (status === 'success' ? '😍 Tests passed!' : '😨 Tests failed!') + '\n\n```\n' + log.replaceAll('%%%', "\n") + '\n```',
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pull_number = ${{ github.event.number }};
const status = '${{ steps.tests.outputs.tests }}';
const log = '${{ steps.tests.outputs.tests_log }}';
require('./.github/scripts/build-ctest-review.js')({
github, context, status, log
github, context, pull_number, status, log
});
- name: CMake Install
run: cmake --install out/build/${{ inputs.cmake-preset }} --prefix out/install/${{ inputs.cmake-preset }}
Expand Down

0 comments on commit 2daff87

Please sign in to comment.