ScaCap / action-surefire-report

Reports surefire test results as GitHub Pull Request Check
Apache License 2.0
88 stars 58 forks source link

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

Open lobodpav opened 8 months ago

lobodpav commented 8 months ago

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/action-surefire-report@v1.7.3
        with:
          report_paths: '**/surefire-reports/*.xml'
          github_token: ${{ secrets.GITHUB_TOKEN }}
nineinchnick commented 1 month ago

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"  
lobodpav commented 1 month ago

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
nineinchnick commented 1 month ago

Are you using the correct owner and repo names?

lobodpav commented 1 month ago

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 🤦

nineinchnick commented 1 month ago

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

lobodpav commented 1 month ago

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.

nineinchnick commented 1 month ago

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.