Files
grimmory/.github/workflows/publish-test-results.yml
T
James Cox 37ca101dd4 fix(ci): correct artifact download action pin
- replace the invalid actions/download-artifact SHA in the workflow_run test-results publisher\n- restore the publisher workflow so it can download CI artifacts and post PR test results\n- keep the new workflow_run-based permissions model intact while fixing the setup-time action resolution failure
2026-03-20 17:20:18 -05:00

74 lines
2.6 KiB
YAML

name: Test Results - Publish
on:
workflow_run:
workflows:
- CI - Validate
types:
- completed
jobs:
publish-test-results:
name: Publish Test Results
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
checks: write
pull-requests: write
steps:
- name: Download Workflow Artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
github-token: ${{ github.token }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Detect Published Test Artifacts
id: detect
run: |
set -eu
if [ -f "artifacts/ci-event-file/event.json" ]; then
echo "event_file=artifacts/ci-event-file/event.json" >> "$GITHUB_OUTPUT"
else
echo "Missing ci-event-file artifact; cannot publish test results." >&2
exit 1
fi
if find artifacts/backend-test-reports -name '*.xml' -print -quit | grep -q .; then
echo "backend_present=true" >> "$GITHUB_OUTPUT"
else
echo "backend_present=false" >> "$GITHUB_OUTPUT"
fi
if find artifacts/frontend-test-reports -name '*.xml' -print -quit | grep -q .; then
echo "frontend_present=true" >> "$GITHUB_OUTPUT"
else
echo "frontend_present=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish Backend Test Results
if: ${{ steps.detect.outputs.backend_present == 'true' }}
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: ${{ steps.detect.outputs.event_file }}
event_name: ${{ github.event.workflow_run.event }}
files: artifacts/backend-test-reports/**/*.xml
check_name: Backend Test Results
- name: Publish Frontend Test Results
if: ${{ steps.detect.outputs.frontend_present == 'true' }}
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: ${{ steps.detect.outputs.event_file }}
event_name: ${{ github.event.workflow_run.event }}
files: artifacts/frontend-test-reports/**/*.xml
check_name: Frontend Test Results