1

在本地运行时yarn version check,一切顺利并正确报告问题,但是当我们的 Github Action 运行时,我们收到以下错误

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 Action 如下:

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检查合并提交的操作可能是问题所在,并且在阅读了“深入了解 pull_request ”之后,我尝试将以下内容添加到我们的操作中,但没有运气:

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

任何帮助理解我们在这里做错了什么都将非常感激:)

4

1 回答 1

0

您可以更新结帐以获取整个 git 历史记录。这将需要更长的时间,但似乎该命令需要跨多个分支和标签。

- name: Checkout
  uses: actions/checkout@v2
  with:
    fetch-depth: 0
于 2020-09-02T15:57:25.980 回答