E2E Report on Pull Request Comment #13
This file contains 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: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download e2e test report artifact | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: e2e-test-reporter | |
github-token: ${{ secrets.GH_ACCESS_TOKEN }} | |
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 staging url | |
if: ${{ !cancelled() }} | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const fs = require('fs') | |
const PRNumber = Number(fs.readFileSync('./pr/number')) | |
const E2ETestReporter = String(fs.readFileSync('./ui/test-report.md')) | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: PRNumber, | |
body: E2ETestReporter | |
}) |