在本地运行时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 }}
任何帮助理解我们在这里做错了什么都将非常感激:)