Nrwl NX新项目和GitHub动作

问题描述

我正在弄清NX,并尝试使用由pull-requests事件触发的GitHub动作来实现CI / CD。我有2个git-hub动作:

  1. pull-request-opened由主分支上的pull_request触发,用于 打开,重新打开,同步类型,仅运行测试目标
  2. pull-request-closed由主分支上的pull_request触发,用于 封闭类型,仅运行部署目标

我遇到的问题是当我从main创建一个新分支时,我打算添加一个新的NX项目。当我创建PR以将新项目重新合并到主项目时,gitHub动作试图为新项目运行“测试”目标,但失败了,因为新项目不在主版本的workspace.json和nx.json中。

这是我的工作流程:

name: pull-request-opened

on:
  pull_request:
    branches:
      - main
    types: [opened, reopened, synchronize]

jobs:
  test:
    name: test affected projects
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]
    steps:
    - name: checkout code
      uses: actions/checkout@v2
      with:
        ref: main
        fetch-depth: 0

    - name: use node.js ${{ matrix.node-version }}
      uses: actions/setup-node@master
      with:
        always-auth: true
        node-version: ${{ matrix.node-version }}

    - name: fetch other branches
      run: git fetch --no-tags --prune --depth=5 origin $GITHUB_BASE_REF

    - name: install dependencies
      run: npm ci

    - name: Nrwl Nx
      uses: MansaGroup/nrwl-nx-action@v1.0.1
      with:
        targets: test
        affected: 'true'

我应该在主分支中创建新项目,然后创建新分支来填充项目吗?这似乎不正确。

我很确定我的方法不正确。在我的仓库中使用基于中继的方法来在我的仓库中创建新的NX项目的正确工作流程是什么?感谢您的帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)