[英]How do I run my CI steps in a specific folder in github action
我有一個帶有react
客戶端的golang
庫。 我想為我的客戶端使用 github 操作設置 CI。 React 客戶client
位於工作區的client
文件夾內。 我編寫了以下工作流程
name : Node.js CI
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: client
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn install
- run: yarn build
但是在提交時顯示以下錯誤
Run yarn build1s
##[error]Process completed with exit code 1.
Run yarn build
yarn run v1.21.1
error Couldn't find a package.json file in "/home/runner/work/evential/evential"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Process completed with exit code 1
片段
- uses: actions/checkout@v2
with:
path: client
不會在client
文件夾中運行以下步驟。
需要幫忙。 提前致謝。
您可以在run
步驟中使用working-directory
關鍵字。 請參閱此處的文檔。
- run: yarn install
working-directory: client
- run: yarn build
working-directory: client
假設您的存儲庫結構如下所示:
.
├── README.md
├── client
│ └── ... # your source files
└── workflows
└── example-ci.yml
您還可以使用以下方法為多個步驟設置默認工作目錄:
defaults:
run:
working-directory: client # The working directory path
這樣您就不需要為每個步驟指定它。 您還可以根據放置上述代碼段的位置調整范圍,用於:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.