E2E Report on Pull Request Comment #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Report on Pull Request Comment | |
| on: | |
| workflow_run: | |
| workflows: ['Meshery UI and Server'] | |
| types: [completed] | |
| permissions: | |
| issues: write | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| e2e-test-reporter: | |
| if: github.repository == 'meshery/meshery' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Download e2e test report artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| name: e2e-test-reporter | |
| github-token: ${{ secrets.MESHERY_CI }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: Retrieve PR Number | |
| run: | | |
| echo "PULL_REQUEST=$(cat ./pr/number)" >> $GITHUB_OUTPUT | |
| id: pr | |
| - name: Find Comment | |
| uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 | |
| id: fc | |
| with: | |
| issue-number: ${{ steps.pr.outputs.PULL_REQUEST }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: END-TO-END TESTS | |
| - name: Delete Previous Comment | |
| if: steps.fc.outputs.comment-id != '' | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| script: | | |
| github.rest.issues.deleteComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: ${{ steps.fc.outputs.comment-id }} | |
| }) | |
| - name: Comment on PR with E2E results | |
| if: ${{ !cancelled() }} | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| script: | | |
| const fs = require('fs') | |
| const PRNumber = Number(fs.readFileSync('./pr/number')) | |
| const PRSha = fs.readFileSync('./pr/sha', 'utf8').trim() | |
| const E2ETestReporter = fs.readFileSync('./ui/test-report.md', 'utf8') | |
| const body = ` | |
| **Commit SHA:** \`${PRSha}\` | |
| ${E2ETestReporter} | |
| ` | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: PRNumber, | |
| body: body | |
| }) |