在 git 个操作中找不到 pylint

Cannot find pylint in git actions

尝试 运行 我在 github 上构建的 pylint 操作,但它说找不到 pylint。

代码

  linting:
    name: PyLint
    runs-on: ubuntu-latest
    needs: install
    steps:
      - uses: actions/checkout@v2
      - run: pip3 install -U pip setuptools
      - run: pip3 install -U -r requirements.txt
      - run: export PATH=/home/runner/.local/bin/$PATH
      - run: pylint --rcfile=.pylintrc src/

错误

Run pylint --rcfile=.pylintrc src/
/home/runner/work/_temp/44ccfc48-998a-405a-b25a-20b24f532ea1.sh: line 1: pylint: command not found
Error: Process completed with exit code 127.

我尝试将它添加到我的 PATH 中,因为我在 pip 安装中收到了这条消息

WARNING: The scripts epylint, pylint, pyreverse and symilar are installed in '/home/runner/.local/bin' which is not on PATH.

但这对问题没有帮助。

似乎 python 配置不正确。您需要在工作流程的开头添加 actions/setup-python 步骤才能正确获得它 set-up。尝试删除行

- run: export PATH=/home/runner/.local/bin/$PATH`

并添加

- uses: actions/setup-python@v2

就在打电话之前 pip

linting:
    name: PyLint
    runs-on: ubuntu-latest
    needs: install
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - run: pip3 install -U pip setuptools
      - run: pip3 install -U -r requirements.txt
      - run: pylint --rcfile=.pylintrc src/

这应该可以解决问题。