Publish Test Report #2105
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: Publish Test Report | |
| # Second half of build-test-debug | |
| # see https://github.com/ctrf-io/github-test-reporter/blob/main/docs/fork-pull-requests.md | |
| on: | |
| workflow_run: | |
| workflows: [ 'Build & Test Debug' ] | |
| types: [ completed ] | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| report: | |
| name: Comment Test Results | |
| if: >- | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.conclusion != 'cancelled' && | |
| github.event.workflow_run.conclusion != 'skipped' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Download CTRF test results | |
| continue-on-error: true | |
| uses: actions/download-artifact@v8 | |
| with: | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| pattern: test-nunit-* | |
| path: /tmp/ctrf-results | |
| - name: Determine PR number | |
| id: pr | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_REPO: ${{ github.repository }} | |
| HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | |
| run: | | |
| PR_NUM=$(gh api "repos/${GH_REPO}/commits/${HEAD_SHA}/pulls" \ | |
| --jq "[.[] | select(.state == \"open\" and .head.sha == \"${HEAD_SHA}\") | .number] | first // empty" || true) | |
| if [ -z "$PR_NUM" ]; then | |
| PR_NUM=$(gh pr list --state open --limit 100 --json number,headRefOid \ | |
| --jq "[.[] | select(.headRefOid == \"${HEAD_SHA}\") | .number] | first // empty" || true) | |
| fi | |
| if [ -z "$PR_NUM" ]; then | |
| echo "No open PR found for head SHA ${HEAD_SHA}; skipping comment" | |
| else | |
| echo "Commenting on PR #${PR_NUM}" | |
| fi | |
| echo "number=${PR_NUM}" >> "$GITHUB_OUTPUT" | |
| - name: Comment test results on PR | |
| if: ${{ steps.pr.outputs.number != '' }} | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: '/tmp/ctrf-results/**/*.json' | |
| title: Content + Integration Test Results | |
| community-report: true | |
| community-report-name: summary-short | |
| failed-folded-report: true | |
| issue: ${{ steps.pr.outputs.number }} | |
| overwrite-comment: true | |
| comment-tag: debug-ci-test-report | |
| exit-on-no-files: false | |
| exit-on-fail: false | |
| report-order: 'summary-short,failed-folded-report' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |