我有以下用于 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.
這只是在我的安裝依賴項下。我錯過了一些非常明顯的東西嗎?預先感謝您的幫助。
uj5u.com熱心網友回復:
是的 - 你有一個簡單的錯誤:)
要擁有多個命令,run您必須使用:
run: |not\
\稍后用于將一個 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
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/433111.html
