From 2daff87a1b7175219f6d14b3c0c60edd3b86f575 Mon Sep 17 00:00:00 2001 From: Piotr Macha Date: Tue, 18 Jun 2024 10:51:56 +0200 Subject: [PATCH] ci: fix CTest bot --- .github/scripts/build-ctest-review.js | 8 ++++---- .github/workflows/build.yml | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/scripts/build-ctest-review.js b/.github/scripts/build-ctest-review.js index aa74214..ca0bab9 100644 --- a/.github/scripts/build-ctest-review.js +++ b/.github/scripts/build-ctest-review.js @@ -1,13 +1,13 @@ -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 @@ -15,7 +15,7 @@ module.exports = async ({github, context, status, log}) => { }); 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```', diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 029a651..017603d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }}