Im working on adding the output of yarn audit as a PR comment. The problem is that all the output of $log is not displayed.
here is the code
- name: Run audit
id: audit
run: |
log="$(yarn audit)"
echo "::set-output name=log::$log"
- name: Create comment
uses: peter-evans/create-or-update-comment@v2
if: github.event_name == 'pull_request'
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.audit.outputs.log }}
now comment is only shows yarn audit v1.22.19
The result I want is this.
yarn audit v1.22.19
0 vulnerabilities found - Packages audited: 768
✨ Done in 0.47s.
I solved it like this.
yarn audit > audit-log.txt log="$(cat output.txt)" log="${log//'%'/'%25'}" log="${log//$'\n'/'%0A'}" log="${log//$'\r'/'%0D'}" echo "::set-output name=log::$log"