diff --git a/.github/githubUtils.js b/.github/githubUtils.js index 9f7dbb254..18381ab78 100644 --- a/.github/githubUtils.js +++ b/.github/githubUtils.js @@ -1,10 +1,5 @@ -const fs = require('fs'); -const path = require('path'); - -async function generateComment(github, context) { - const percyUrl = context.outputs.percy_url; - - return ` +async function generateComment(percyUrl) { + return ` ### Percy Visual Test Results **Percy Dashboard:** [View Detailed Report](${percyUrl}) @@ -45,4 +40,4 @@ async function findComment(github, context, issue_number) { module.exports = { findComment, generateComment, -} \ No newline at end of file +} diff --git a/.github/workflows/visual_tests.yml b/.github/workflows/visual_tests.yml index b7294e1ae..39c6b64fb 100644 --- a/.github/workflows/visual_tests.yml +++ b/.github/workflows/visual_tests.yml @@ -64,13 +64,18 @@ jobs: if: ${{ needs.visual_tests.result == 'success' }} runs-on: ubuntu-latest steps: + - name: Checkout code from PR + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Define comment body id: comment-text uses: actions/github-script@v7 with: script: | + const percyUrl = "${{ needs.visual_tests.outputs.percy_url }}"; const utils = require('./.github/githubUtils.js'); - return await utils.generateComment(github, context); + return await utils.generateComment(percyUrl); - name: Find existing comment id: find-comment uses: actions/github-script@v7 @@ -101,4 +106,4 @@ jobs: repo: context.repo.repo, comment_id: ${{steps.find-comment.outputs.result}}, body: ${{ steps.comment-text.outputs.result }} - }) \ No newline at end of file + })