[英]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.