【发布时间】:2021-09-25 08:49:23
【问题描述】:
我正在尝试设置一个 github 操作,以在构建拉取请求后自动评论大小增量。本质上,我需要将“计算代码大小增量”命令的输出包含在根据拉取请求自动创建的注释中。
下面是当前操作的 2 个步骤:
- name: Diff revision
id: diff_rev
shell: bash
working-directory: cobrax
run: |
echo "::set-output name=delta_code::$(python3 codesizes.py diff build/zephyr/zephyr.elf)\n"
- name: Auto Comment
uses: bubkoo/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: >
???? @{{ author }}
Thank you for raising your pull request.
This is the code delta:
${{join(steps.diff_rev.outputs.delta_code, '\n')}}
Please make sure you have followed our contributing guidelines. We will review it as soon as possible
控制台显示如下结果:
Using git merge-base against master branch
Comparing code size of current .elf against: 30ac63fd5ea039c7b874a999f928f41220ad883f
+---------+--------+-------+-------+
| Region | .text | .data | .bss |
+---------+--------+-------+-------+
| Local | 113298 | 2412 | 31355 |
| Against | 113298 | 2412 | 31355 |
| Delta | 0 | 0 | 0 |
+---------+--------+-------+-------+\n
你可以清楚地看到,我使用 set-output 来存储结果(或者,我认为这就是它的作用),然后在评论中使用输出变量。但这显然行不通。
bubkoo/auto-comment 动作的输出是:
octokit.reactions.deleteLegacy() is deprecated, see https://developer.github.com/v3/reactions/#delete-a-reaction-legacy
(node:3588) UnhandledPromiseRejectionWarning: HttpError: Not Found
at /__w/_actions/bubkoo/auto-comment/v1/dist/index.js.cache.js:1:76457
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:3588) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3588) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
并且,注释显示为:“[...] 这是代码增量:针对主分支使用 git merge-base 请确保 [...]”。短语“使用 git merge-base 反对 master 分支确实会附加到评论中,但显然不是整个控制台输出。
我做错了什么,你将如何使用 github 操作来做这件事?
感谢您的帮助。
最好的问候。
【问题讨论】:
标签: github github-actions pull-request