MishaKav / jest-coverage-comment

Comments a pull request or commit with the jest code coverage badge, full report and tests summary
MIT License
80 stars 34 forks source link

dynamic multiple-files #72

Closed ngonzalezromero closed 1 year ago

ngonzalezromero commented 1 year ago

Hello, is there any way to dynamically pass information to the multiple-files field? I have tried to do it with environment variables.

multiple-files: | echo "${MULTILINE_STRING}"

also reading a file and execute it with cat command

multiple-files: | echo  $(cat mystring.txt)

the file looks like

Test 1, ./coverage/coverage-summary/core-report.json 
Test 2, ./coverage/coverage-summary/report.json

but I'm always getting this error :

Generating summary report for multiple files. No files are provided

Thanks a tons for any advice

MishaKav commented 1 year ago

the problem is "how to load multiple-line text" into a variable. After playing a bit with it, get it to work with other github-action, here are a working example (pretty sure that are more ways to do it):

- name: Read dynamic-multiple-files.txt
  id: multiplefiles
  uses: jaywcjlove/github-action-read-file@main
  with:
    path: data/dynamic-multiple-files.txt

- name: Jest Coverage Comment
  uses: MishaKav/jest-coverage-comment@main
  with:
    multiple-files: ${{ steps.multiplefiles.outputs.content }}
SirPhemmiey commented 5 months ago

Hi @MishaKav it still didn't work for me.