action-surefire-report icon indicating copy to clipboard operation
action-surefire-report copied to clipboard

When run on `workflow_dispatch`, no `Test Report` appears

Open lobodpav opened this issue 1 year ago • 7 comments

I have a workflow defined that allows running on push action and allows manual execution too.

When run on push, everything works fine. When run manually (i.e. on workflow_dispatch), no Test Report job appears and annotations are missing too.

What am I doing wrong?

name: My workflow

on:
  push:
    branches:
      - dev
  workflow_dispatch:


jobs:
  build:
    name: Build and verify
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source
        uses: actions/checkout@v2

      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 11

      - name: Build with Maven
        run: ./mvnw -B verify -T 1C

      - name: Publish test reports
        if: ${{ always() }}
        uses: scacap/[email protected]
        with:
          report_paths: '**/surefire-reports/*.xml'
          github_token: ${{ secrets.GITHUB_TOKEN }}

lobodpav avatar Jan 24 '24 17:01 lobodpav

I was just debugging this, and found that the check got created, but wasn't displayed in my main workflow's run, because I had more than one workflow executing for a particular commit. Try listing the checks like so:

curl \ 
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: Bearer $GITHUB_TOKEN" \ 
  "https://api.github.com/repos/$OWNER/$REPO/commits/$COMMIT_SHA/check-runs"  

nineinchnick avatar Aug 30 '24 14:08 nineinchnick

I am probably dumb or I don't know. Tried to run this on multiple commits and I always get HTTP 404. I tried both the short and long commit SHAs that GitHub presents on a workflow run. Screenshot 2024-08-30 at 17 19 40

lobodpav avatar Aug 30 '24 15:08 lobodpav

Are you using the correct owner and repo names?

nineinchnick avatar Aug 30 '24 15:08 nineinchnick

Yep, just copied these from the URL of the repo I am in. However, I just got an idea - it's probably my token that has limited scope to read:packages 🤦

lobodpav avatar Aug 30 '24 15:08 lobodpav

Maybe the github token you're using doesn't have permissions to read from this repo.

nineinchnick avatar Aug 30 '24 15:08 nineinchnick

It works with the correct token now. The query listed multiple workflows, such as build, test, assign reviewers, and so on. However, I don't know how to figure out if multiple workflows were running in parallel.

It might have happened that another workflow was running along with the workflow_dispatch. However, when I check all workflow_dispatch runs, none of them has test results.

lobodpav avatar Aug 30 '24 15:08 lobodpav

You should be able to find the test report check on that list. There's a url field, open that in your browser, and it'll list all workflow runs for that commit. They don't have to run in parallel. It's just a limitation of the github api, that you can only create a check run for a commit, not for a check suite.

nineinchnick avatar Aug 30 '24 16:08 nineinchnick