Create PR Comments #4
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: Create PR Comments | |
| on: | |
| workflow_run: | |
| workflows: ["Tests"] | |
| types: [completed] | |
| permissions: | |
| contents: read | |
| actions: read | |
| pull-requests: write | |
| jobs: | |
| pr-comment: | |
| name: Post Test Result as PR comment | |
| runs-on: ubuntu-24.04 | |
| if: github.event.workflow_run.event == 'pull_request' | |
| steps: | |
| - name: Download CTRF artifact | |
| uses: dawidd6/action-download-artifact@v8 | |
| with: | |
| github_token: ${{ github.token }} | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: ctrf-report | |
| path: ctrf | |
| - name: Download PR Number Artifact | |
| uses: dawidd6/action-download-artifact@v8 | |
| with: | |
| github_token: ${{ github.token }} | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: pr_number | |
| path: pr_number | |
| - name: Read PR Number | |
| run: | | |
| PR_NUMBER=$(cat pr_number/pr_number.txt | grep -E '^[0-9]+$') | |
| if [ -z "$PR_NUMBER" ]; then | |
| echo "Error: PR_NUMBER is not a valid integer." | |
| exit 1 | |
| fi | |
| echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | |
| - name: Post PR Comment | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: 'ctrf/**/*.json' | |
| issue: ${{ env.PR_NUMBER }} | |
| summary: true | |
| pull-request: true | |
| use-suite-name: true | |
| update-comment: true | |
| always-group-by: true | |
| overwrite-comment: true | |
| upload-artifact: false | |
| pull-request-report: true | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} |