When running yarn version check
locally everything goes smoothly and reports issues correctly, however when our Github Action runs it we get the following error:
YN0001: UsageError: No ancestor could be found between any of HEAD and main, origin/main, upstream/main
Our yarnrc.yml
looks as follows:
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
Our Github Action is as follows:
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
I thought perhaps because the pull_request
action checks out the merge commit may be the issue and after reading "a deep dive into pull_request", I tried adding the following to our action without luck:
with:
ref: ${{ github.event.pull_request.head.sha }}
Any help understanding what we're doing wrong here would be super appreciated :)
You can update your checkout to fetch the entire git history. It will take longer, but it seems that this command needs that across multiple branches and tags.