纱线 2:CI 期间的“纱线版本检查”总是出错
Yarn 2: `yarn version check` during CI always errors
当 运行 yarn version check
在本地一切顺利并正确报告问题时,但是当我们的 Github 操作运行时,我们得到 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 }}
任何有助于理解我们在这里做错了什么的人都将不胜感激:)
您可以更新结帐以获取 entire git history。这将需要更长的时间,但似乎此命令需要跨越多个分支和标签。
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
当 运行 yarn version check
在本地一切顺利并正确报告问题时,但是当我们的 Github 操作运行时,我们得到 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 }}
任何有助于理解我们在这里做错了什么的人都将不胜感激:)
您可以更新结帐以获取 entire git history。这将需要更长的时间,但似乎此命令需要跨越多个分支和标签。
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0