首页 > 解决方案 > nx affected not working with --base and --head

问题描述

I'm trying to run nx affected:build inside a GitHub push action, yet I'm getting the No projects with build were run (this happens against lint/test/build). I know for a fact that projects are affected b/c I run nx affected:build on them prior to making a PR and the build runs.

At first I suspected it might be because I was operating in the Github push action. So I tried using various --base and --head parameters, but nothing worked.

Then I tried running these same commands locally, and nx affected:build still produced nothing, even though git diff clearly showed that a project was affected. It's only until I run nx affected:build ==base=<branch> that the affected project will be built.

Eg:

// Doesn't work, even though there is a diff.
nx affected:build --base=197458c645479844fc235ea09b5ae12048b7fa35 --head=da8fad48d67bd8a0c59b8fbecba0bdf7c90fdf6e

// Works
nx affected:build --base=develop

What am I missing here? Why can't I supply --base and --head parameters to specify the exact commits to run nx affected against?

标签: nrwl-nx

解决方案


看来我有basehead倒退:

--base  Base of the current branch (usually master)
--head  Latest commit of the current branch (usually HEAD)

当我切换 SHA 时,nx affected产生了预期的结果。


推荐阅读