action-surefire-report
action-surefire-report copied to clipboard
When run on `workflow_dispatch`, no `Test Report` appears
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 }}
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"
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.
Are you using the correct owner and repo names?
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
🤦
Maybe the github token you're using doesn't have permissions to read from this repo.
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.
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.