Coverage File Not Being Created

During the Action the coverage file should be created, which should then be picked up by SonarCloud. Unfortunately, it isnt being created - no error or anything, it just seems to get skipped!

Here’re the relevant blocks in the Action:

    - name: Pytest with Coverage
      if: always()
      run: |
        poetry run python -m pytest --cov=.

    - name: Push changes
      if: github.repository == 'Snayff/notquiteparadise'
      run: |
        git config --global user.name 'snayff'
        git config --global user.email 'snayff@users.noreply.github.com'
        git commit -am "ci lint and test"
        git push

Full Action is here.
Action log is here

Any help would be appreciated!

Does the coverage file already exist in the repository? git commit -a is not going to add new files, only modified and deleted ones.

1 Like

Ah, no, it doesnt. I (wrongly) thought -am would push all changes, including new files. What should it be instead?

git add the file, then do a regular commit. That works for new and changed files alike. A git status in between may be useful for debugging, so you can see if the right changes have been staged. :slightly_smiling_face:

You’re a star, thank you very much!

1 Like