Github操作问题-错误:进程已完成,退出代码为2



我有以下github操作的代码:

name: Python application
on:
push:
branches: [ main ]
jobs: 
build: 

runs-on: ubuntu-latest

steps: 
- uses: actions/checkout@v2
- name: Install dependencies 
run: /
python -m pip install --upgrade pip
python -m pip install numpy pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test Selenium
run: /
python -m pytest -v -m devs

但当我提交,并且操作开始运行时,我会得到以下错误:

Run / python -m pip install --upgrade pip python -m pip install numpy pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
/ python -m pip install --upgrade pip python -m pip install numpy pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
shell: /usr/bin/bash -e {0}
/home/runner/work/_temp/317511f5-0874-43d8-a0ae-2601804ff811.sh: line 1: syntax error near unexpected token `then'
Error: Process completed with exit code 2.   

这就在我的安装依赖项下。我是不是错过了一些非常明显的东西?提前感谢您的帮助。

是的-你有一个简单的错误:(

要在run下有多个命令,必须使用:run: |而非

稍后用于将一个bash命令拆分为多行

name: Python application
on:
push:
branches: [ main ]
jobs: 
build: 

runs-on: ubuntu-latest

steps: 
- uses: actions/checkout@v2
- name: Install dependencies 
run: |
python -m pip install --upgrade pip
python -m pip install numpy pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test Selenium
run: |
python -m pytest -v -m devs

相关内容

  • 没有找到相关文章

最新更新