簡體   English   中英

如何在github actions中獲取yarn命令輸出

[英]How to get yarn command output in github actions

我正在努力將 yarn audit 的輸出添加為 PR 評論。 問題是沒有顯示 $log 的所有輸出。

這是代碼

      - 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 }}

現在評論只顯示yarn audit v1.22.19

我想要的結果是這樣的。

yarn audit v1.22.19
0 vulnerabilities found - Packages audited: 768
✨  Done in 0.47s.

我是這樣解決的。

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"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM