首页 > 解决方案 > 如何在 github 操作的特定文件夹中运行我的 CI 步骤

问题描述

我有golang一个客户的回购react。我想为我的客户使用 github 操作设置 CI。React 客户端位于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文件夹内运行。

需要帮忙。提前致谢。

标签: node.jsgithub-actions

解决方案


您可以在一个步骤中使用working-directory关键字。请参阅此处run的文档。

    - run: yarn install
      working-directory: client

    - run: yarn build
      working-directory: client

推荐阅读