Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_PNPM_FILTER_CHANGED  - false positive, breaks ci #5438

Open
tomdavidson opened this issue Oct 1, 2022 · 6 comments
Open

ERR_PNPM_FILTER_CHANGED  - false positive, breaks ci #5438

tomdavidson opened this issue Oct 1, 2022 · 6 comments

Comments

@tomdavidson
Copy link

pnpm version:

7.12.2

Code to reproduce the issue:

pnpm --filter-prod="...[main]" test:e2e

Expected behavior:

Expected to execute the run script, test:e2e, in each workspace that has has changed compared to a common ancestor node with the main branch, as well as workspace that are dependent on the change.

Actual behavior:

Filtering workspace packages based on what has changed in a GitHub workflow fails:

Run pnpm --filter-prod "...[main]" test:e2e
  pnpm --filter-prod "...[main]" test:e2e
  shell: /usr/bin/bash -e {0}
  env:
    BRANCH_NAME: chromatic
    TARGET_BRANCH_NAME: main
    PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
 ERR_PNPM_FILTER_CHANGED  Filtering by changed packages failed. fatal: bad revision 'main'
Error: Process completed with exit code 1.

Additional information:

I can not find docs on  ERR_PNPM_FILTER_CHANGED and opened issue for the website.

But this test case provides a description of what is being tested when that error is expected, 'selection should fail when diffing to a branch that does not exist'

The 'main' branch absolutely does exist.

  • node -v prints: v18.8.0
  • Windows, macOS, or Linux?: Linux
@lvqq
Copy link
Member

lvqq commented Oct 2, 2022

Here is the source code about the test case. The error comes up while the branch doesn't exist.

@tomdavidson
Copy link
Author

Im not sure why I am getting this error from git. Im expecting pnpm --filter-prod="[main]" to give me packages/ui would this no such file or directory bork pnpm ?

$ git diff --name-only main..HEAD 
error: cannot run delta: No such file or directory
.github/actions/setup-node/action.yml
.github/workflows/pr-lint.yml
.gitignore
package.json
packages/ui/package.json
pnpm-lock.yaml
turbo.json

@jalbertsr
Copy link

I'm having exactly the same problem.

I'm trying to run my pipeline in a monorepo where I just want folders inside packages/** to run command publish if something changed since [origin/master].

pnpm --filter "{packages/**}[origin/master]" publish --publish-branch master --no-git-checks

but it fails with:

ERR_PNPM_FILTER_CHANGED  Filtering by changed packages failed. 
Error: Process completed with exit code 1.

@trappar
Copy link

trappar commented Feb 6, 2023

I'm also seeing this problem. Same exact situation as @jalbertsr.

@TenviLi
Copy link

TenviLi commented Feb 23, 2023

I'm also seeing this problem.

ERR_PNPM_FILTER_CHANGED  Filtering by changed packages failed. fatal: bad revision 'origin/main'

PS: This problem only found in Gitlab CI environment. I used this [since] filtering feature in local successfully.

@TenviLi
Copy link

TenviLi commented Feb 23, 2023

I'm also seeing this problem.

ERR_PNPM_FILTER_CHANGED  Filtering by changed packages failed. fatal: bad revision 'origin/main'

PS: This problem only found in Gitlab CI environment. I used this filtering in local successfully.

Finally, i solved this problem.

actions/checkout#118 (comment)

Just need to fetch git branch manually at first.

git fetch --no-tags --prune --depth=1 origin +refs/heads/main:refs/remotes/origin/main
pnpm -r --filter "...[origin/main]" run --if-present build

I guess that in the CI environment, the logic of Git's pulling and fetching may be different from local development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants