如何在github中的特定文件夹中运行CI步骤

时间:2020-02-10 07:11:12

标签: node.js github-actions

我有一个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文件夹中运行以下步骤。

需要帮助。预先感谢。

1 个答案:

答案 0 :(得分:2)

您可以在working-directory步骤中使用run关键字。请参阅文档here

    - run: yarn install
      working-directory: client

    - run: yarn build
      working-directory: client