fgrosse / go-coverage-report

A CLI tool and GitHub Action to post Go code coverage reports as comment to your pull requests.
BSD 3-Clause "New" or "Revised" License
53 stars 8 forks source link

Fails due to file exists on target branch #25

Closed peter-crist closed 3 months ago

peter-crist commented 3 months ago

If any artifact exists in the target branch run that is not explicitly the coverage file, you'll get a conflict on download.

Download code coverage results from target branch
  ++ gh run list --status=success --branch=main --workflow=CI --event=push --json=databaseId --limit=1 -q '.[] | .databaseId'
  + LAST_SUCCESSFUL_RUN_ID=9388144932
  + '[' -z 9388144932 ']'
  + gh run download 9388144932 --name=unit-test-output --dir=.github/outputs
  error downloading unit-test-output: error extracting zip archive: error extracting "x-report.json": open .github/outputs/x-report.json: file exists

This likely occurs because to avoid the conflict, the previous step renames the coverage file to NEW_COVERAGE_PATH, but it only does so for the COVERAGE_FILE_NAME and not extraneous files in the artifact. I'd recommend renaming the output directory to --dir=.github/outputs/new_coverage and --dir=.github/outputs/old_coverage respectively.

fgrosse commented 3 months ago

Ah I see. So when you upload your code coverage artifact, you might actually chose to include other files as well such as different formats of the code coverage results.