Skip to content

Commit 6a61fe7

Browse files
Enable TUnit test report artifact upload in GitHub Actions (#902)
TUnit can automatically upload HTML test reports as workflow artifacts and link them in the step summary when running in GitHub Actions — but only if `ACTIONS_RUNTIME_TOKEN` is available to the shell process, which it isn't by default (it's only exposed inside JS/Docker action handlers). ## Changes - Added an **"Expose GitHub Actions Runtime"** step using `actions/github-script@v7` immediately before the `dotnet test` step in both workflow files: - `.github/workflows/PR-Build-And-Test.yml` - `.github/workflows/Build-Test-And-Deploy.yml` ```yaml - name: Expose GitHub Actions Runtime uses: actions/github-script@v7 with: script: | core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']); core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']); - name: Run .NET Tests run: dotnet test ... ``` With this in place, TUnit will upload the test report as a workflow artifact and add a direct link to it in the step summary on each run. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent 8c0f329 commit 6a61fe7

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/Build-Test-And-Deploy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ jobs:
4343
- name: Build with dotnet
4444
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
4545

46+
- name: Expose GitHub Actions Runtime
47+
uses: actions/github-script@v7
48+
with:
49+
script: |
50+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']);
51+
core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']);
52+
4653
- name: Run .NET Tests
4754
run: dotnet test --no-build --configuration Release
4855

.github/workflows/PR-Build-And-Test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ jobs:
3434
- name: Build with dotnet
3535
run: dotnet build --configuration Release --no-restore /p:AccessToNugetFeed=false
3636

37+
- name: Expose GitHub Actions Runtime
38+
uses: actions/github-script@v7
39+
with:
40+
script: |
41+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']);
42+
core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']);
43+
3744
- name: Run .NET Tests
3845
run: dotnet test --no-build --configuration Release --report-trx --coverage --results-directory ${{ runner.temp }}
3946

0 commit comments

Comments
 (0)