我尝试创建一个github操作,该操作在./示例文件夹上运行。/.example文件夹中的代码是通过创建-反应-应用程序构建的。
工作流代码:
name: CI
on:
push:
branches: [ origin ]
pull_request:
branches: [ origin ]
jobs:
build_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test example
working-directory: example
run: |
npm install
npm run build --if-present但它会导致一个错误:

我的项目结构(在./示例中有package.json):

发布于 2021-07-27 18:26:38
您的工作流yaml文件应该如下所示。
name: CI
on:
push:
branches: [ origin ]
pull_request:
branches: [ origin ]
jobs:
build_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test example
working-directory: ./example
run: |
npm install
npm run build --if-presenthttps://stackoverflow.com/questions/68549572
复制相似问题