Closed jshufro closed 1 month ago
I just completed testing the feature via https://github.com/fgrosse/prioqueue/pull/5 where I tried to emulate your use case of adding a prefix to the generated comment. This gives me the confidence to go ahead and merge the PR as it is right now.
In order to use this version in your workflow, you need to make sure, your Leave a comment with a link
step treats the newlines from the output string correctly (i.e. keeps them in the string and does not interpolate them inside the javascript code itself). The following approach worked well in my tests:
- name: Leave a comment with a link
uses: actions/github-script@v6
with:
script: |
const report = `${{ steps.report-step.outputs.coverage_report }}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[Coverage Report](${{ needs.unit_tests.outputs.html-coverage-url }})\n${report}`
})
Closes #34
An example of it working can be seen here https://github.com/Rocket-Rescue-Node/rescue-proxy/pull/66#issuecomment-2234262491