test-reporter: Test Reporter fails on workflow_run

I have two step

...
      - uses: actions/upload-artifact@v4
        if: success() || failure()
        with:
          name: test-results
          path: "**/test-results*.trx"
...

and

name: report
on:
  workflow_run:
    workflows: 
      - build
    types:
      - completed
permissions: 
  contents: read
  actions: read
  checks: write
jobs:
  report:
    runs-on: ubuntu-latest
    steps:
      - uses: dorny/test-reporter@v1
        with:
          artifact: test-results
          name: dotnet tests
          path: '**/test-results*.trx'
          reporter: dotnet-trx

trx file is successfully uploaded, inspecting the URL of test reporter action, it offers me to download the file, but the action fails

Report fails with error HTTPError: Response code 400 (Authentication information is not given in the correct format. Check the value of Authorization header.)

Additional info: it worked, but after I bumped the version of the upload-artifacts (among other), somehow stopped working…

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@jozefizso are you aware of any way to fix this? Would it require bumping the major version here as well, or could it be made compatible with either?

FIY again, I also created a feature request for support of raw_details in annotations created from workflows. I hope that would eventually make the need for a separate workflow obsolete.

Simply downgrading should be enough.

It is not. As I previously said, it produces this failure:

Warning: No artifact matches /(Functional on .*) test-results/

when the artifact list clearly has artifacts that match the RE:

Functional on EL 8.8 test-results
Functional on EL 9 test-results

Even if you applied fixes, it looks like any changes you did to accommodate v4, would work with v3. I think the main issue is same-named artifacts, which don’t work anymore.

They don’t have the same name though. One has 8.8 in it where the other has 9.

I.e. isn’t is completely broken at this point now?

It is actually artifacts@v4 that is broken. They chose to, deliberately, make it backwards incompatible. And the guide to fix it isn’t all that useful.

So is simply downgrading the actions/upload-artifact action to v3 not enough to work around this issue?

Simply downgrading should be enough. See the breaking changes here: https://github.com/actions/upload-artifact?tab=readme-ov-file#breaking-changes

Even if you applied fixes, it looks like any changes you did to accommodate v4, would work with v3. I think the main issue is same-named artifacts, which don’t work anymore.

@jozefizso said previously:

Yes, this caused by different behavior in artifacts v4: github.blog/changelog/2023-12-14-github-actions-artifacts-v4-is-now-generally-available

So given that it’s 4 months on since the above comment, what’s the plan to fix this?

How is this action in any way usable given this issue? I.e. isn’t is completely broken at this point now? Or does this issue only affect certain use cases of this action? If so, which use cases are still working?

FYI I was able to make this work using a similar workflow_run setup by manually invoking the download-artifact action at v4:

on:
  workflow_run:
    workflows: ["test"]
    types:
      - completed

jobs:
  report:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          pattern: test-result-*
          merge-multiple: true
          run-id: ${{ github.event.workflow_run.id }}
      - name: Generate report
        uses: dorny/test-reporter@v1
        with:
          name: test report
          path: "*.trx"
          reporter: dotnet-trx

You have to generate your own secrets.PERSONAL_ACCESS_TOKEN for the download-artifact action to be able to download artifacts from outside its own workflow. (see: https://github.com/actions/download-artifact#download-artifacts-from-other-workflow-runs-or-repositories) The workflow to download from is specified using ${{ github.event.workflow_run.id }}