Skip to content

Test Results (reference) #442

Test Results (reference)

Test Results (reference) #442

Workflow file for this run

name: Test Results (reference)
on:
workflow_run:
workflows: ["CI/CD"]
types:
- completed
permissions: {}
jobs:
test-results:
name: Test Results (reference)
if: github.event.workflow_run.conclusion != 'skipped'
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Publish Test Results
id: test-results
uses: step-security/publish-unit-test-result-action/composite@main
with:
commit: ${{ github.event.workflow_run.head_sha }}
check_name: Test Results (reference)
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
check_run_annotations_branch: "master, master-1.x, devel-1.0, devel-2.0"
files: "artifacts/**/*.xml"
log_level: DEBUG
- name: Set badge color
if: github.event.workflow_run.event != 'schedule'
run: |
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
success)
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
;;
failure)
echo "BADGE_COLOR=800000" >> $GITHUB_ENV
;;
neutral)
echo "BADGE_COLOR=696969" >> $GITHUB_ENV
;;
esac
shell: bash
- name: Create badge
if: github.event.workflow_run.event != 'schedule'
uses: emibcn/badge-action@4209421db54c8764d8932070ffd0f81715a629bf
with:
label: Tests
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
color: ${{ env.BADGE_COLOR }}
path: tests.svg
- name: Upload badge to Gist
# Upload only for master branch and not for scheduled event
if: >
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'master' && github.event.workflow_run.event != 'schedule'
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.githubusercontent.com/step-security/612cb538c14731f1a8fefe504f519395
file: tests.svg