简体   繁体   English

如何在 PR 评论中留下 github 操作运行结果

[英]How to leave the github actions run result in the PR comments

I want to leave the result of "run audit" as a PR comment, but I don't know how.我想留下“运行审计”的结果作为 PR 评论,但我不知道如何。 I'd appreciate your help.我会很感激你的帮助。

      - name: Run audit
        run: yarn audit

You can use one of the existing GitHub actions from Marketplace.您可以使用 Marketplace 中现有的 GitHub 操作之一。

One solution will be:一种解决方案是:

- name: Run audit
  id: audit
  run: |
     log="$(yarn audit)"
     echo "::set-output name=log::$log"
- name: Create or update comment
  uses: peter-evans/create-or-update-comment@v2
  with:
    issue-number: ${{ github.event.pull_request.number }}
    body: ${{ steps.audit.outputs.log }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM