纱线2:CI期间始终出现“纱线版本检查”错误

问题描述

在本地运行yarn version check时一切正常,并且可以正确报告问题,但是当我们的Github Action运行时,我们得到the following error

YN0001: UsageError: No ancestor could be found between any of HEAD and main,origin/main,upstream/main

我们的yarnrc.yml如下所示:

changesetBaseRefs:
  - main
  - origin/main
  - upstream/main

changesetIgnorePatterns:
  - '**/*.test.{ts,tsx}'
  - '**/*.stories.{ts,tsx}'

nodeLinker: node-modules

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
    spec: '@yarnpkg/plugin-workspace-tools'
  - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
    spec: '@yarnpkg/plugin-typescript'
  - path: .yarn/plugins/@yarnpkg/plugin-version.cjs
    spec: '@yarnpkg/plugin-version'

yarnPath: .yarn/releases/yarn-berry.js

我们的Github动作如下:

name: Version

on:
  pull_request:
    branches:
      - main

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
      - uses: actions/cache@v1
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
      - name: Install dependencies
        if: steps.yarn-cache-dir-path.outputs.cache-hit != 'true'
        run: yarn
      - name: Check
        run: yarn bump:check

我想也许是因为pull_request操作检查了合并提交可能是问题所在,并且在阅读了“ a deep dive into pull_request”之后,我尝试将以下内容添加到我们的操作中却没有运气:

with:
  ref: ${{ github.event.pull_request.head.sha }}

任何帮助您了解我们在这里做错了的事情,将不胜感激:)

解决方法

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

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

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