在本地运行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 }}
任何帮助您了解我们在这里做错了的事情,将不胜感激:)
答案 0 :(得分:0)
您可以更新结帐信息以获取entire git history。这将花费更长的时间,但似乎此命令需要跨多个分支和标签使用。
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0