mde*_*gis 1 python flake8 github-actions
如果有超过 100 个 flake8 错误,我想对 PR 发表评论,但它不会禁用合并按钮。
我的方法是这样的:
name: Flake8 Check
on: [pull_request]
jobs:
flake8:
name: Flake8 Check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install dependency
run: pip install flake8
- name: Flake8
id: flake
run: echo "::set-output name=number::$(flake8 --config=tools/dev/.flake8 --count -qq)"
- name: comment PR
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "There are ${{ steps.flake.outputs.number }} Flake8 errors which is a lot :disappointed: \nThis will not block you to merge it but please try to fix them."
check_for_duplicate_msg: true
if: ${{ steps.flake.outputs.number }} > 100
Run Code Online (Sandbox Code Playgroud)
然而,尽管错误不到 100 个,但它仍在评论。我已经检查了文档,它对我来说看起来是正确的。
我缺少什么?
在contexts的 github actions 页面上,他们建议不要${{ }}在 context 的条件下使用if,尽管它们也显示了if使用该语法的条件,${{ }}但我想它实际上并不像您在此处所示的那样工作。
因此,对于您的情况,您需要将其更改if为:
if: steps.flake.outputs.number > 100
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2576 次 |
| 最近记录: |