Skip to content

[BUG] Syntax error if no files to upload found #121

@martincostello

Description

@martincostello

Describe the bug

If the build that is intended to produce test reports fails (so no reports are generated), the action logs a warning due a syntax error.

Run codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706
==> linux OS detected
https://cli.codecov.io/latest/linux/codecov.SHA256SUM
gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key 806BB28AED779869: public key "Codecov Uploader (Codecov Uploader Verification Key) <security@codecov.io>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Wed Apr  9 03:02:55 2025 UTC
gpg:                using RSA key 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <security@codecov.io>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2703 4E7F DB85 0E0B BC2C  62FF 806B B28A ED77 9869
==> Uploader SHASUM verified (0f7aadde579ebde1443ad2f977beada703f562997fdda603f213faf2a8559868  codecov)
==> Running version latest
==> Running version v10.4.0
==> Running command '/home/runner/work/_actions/codecov/test-results-action/f2dba722c67b86c6caa034178c6e4d35335f6706/dist/codecov do-upload'
/home/runner/work/_actions/codecov/test-results-action/f2dba722c67b86c6caa034178c6e4d35335f6706/dist/codecov do-upload -F linux -C fd453b69cc371829dc7e1f7f77ad66da47a9f377 --report-type test_results
/home/runner/work/_actions/codecov/test-results-action/f2dba722c67b86c6caa034178c6e4d35335f6706/dist/codecov: 1: Syntax error: ")" unexpected
Warning: Codecov: Failed to properly upload report: The process '/home/runner/work/_actions/codecov/test-results-action/f2dba722c67b86c6caa034178c6e4d35335f6706/dist/codecov' failed with exit code 2

To Reproduce

Run a workflow containing the step below with no other content that generates test results to upload.

- name: Upload test results to Codecov
  uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706 # v1.1.0
  if: ${{ !cancelled() }}
  with:
    token: ${{ secrets.CODECOV_TOKEN }}

Expected behavior

The action handles the lack of files in an appropriate manner.

Regression

Unknown.

Product Area

test analytics

Versions

  • OS: Linux
  • Git Host: GitHub
  • CI/CD: GitHub Actions
  • Uploader: test-results-action@v1.1.0

Commit and CI link

Workflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions