MishaKav / pytest-coverage-comment

Comments a pull request with the pytest code coverage badge and full report

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Links in report don't work in pull_request_target

chrisoro opened this issue · comments

#113 added the possibility to run this action pull_request_target event. Sadly, the links in the comment are broken.
The generated link points to xxx/repo_name/blob/undefined/filepath is incorrect and results in a 404.

Looking at your changes, there are several places where the eventName is checked by weren't extended for the new event.

Namely:
https://github.com/MishaKav/pytest-coverage-comment/blob/main/src/index.js#L83
https://github.com/MishaKav/pytest-coverage-comment/blob/main/src/index.js#L258

I don't know if that is the issue, I haven't understood your the code completely and am new to github actions

You are right, I think I missed a few places, can you please check this branch before I release a new version?

- name: Pytest Coverage Comment
  uses: MishaKav/pytest-coverage-comment@fix_pull_request_target_links

In my usual private org it would take too long to set it up (since public actions need to be mirrored and so on) but I added a small repo here which you can use to test.

Feel free to fork, change whatever, create a pr and see the results: https://github.com/chrisoro/test_workflow

Thanks for your effort, I fork your repo and will use it for my tests 👍 (it had another problem #68)
According to breaking links, I follow up with code and logic, so my latest fix should fix your problem, fill free to open a new issue if you will find another bug.

- name: Pytest Coverage Comment
  uses: MishaKav/pytest-coverage-comment@main

or use a specific version

- name: Pytest Coverage Comment
  uses: MishaKav/pytest-coverage-comment@v1.1.45

Looks good, thank you!