DEV Community

Discussion on: Running Nx Affected Commands in GitHub Actions

Collapse
 
devinshoemaker profile image
Devin Shoemaker

Thanks! I have noticed that this doesn't appear to work with PR's from a separate repo (e.g. somebody made a PR to my open source project and the workflow failed due to branching weirdness). However, if you're not dealing with forked repos then this should work well! If I find a solution for forked repos then I will be posting an update.

Collapse
 
poloagustin profile image
Agustin Polo

Any ideas on those forking cases? I'm dealing with
Error: Command failed: git merge-base origin/master HEAD
Was hoping this post would shine a light on this 😅

Thread Thread
 
poloagustin profile image
Agustin Polo

For forked repos I was able to run a gh actions workflow by removing the ref: ${{ github.event.pull_request.head.ref }} from your example. This enabled the workflow to pull the forked branch commit, with it's history, then fetch the base master branch with the defined depth and the affected:lint command worked in the end :)
Hope it helps someone!

Thread Thread
 
devinshoemaker profile image
Devin Shoemaker

Cool! Thanks for the reply! I will test that out and update the post if it works well!

Thread Thread
 
devinshoemaker profile image
Devin Shoemaker

I finally got around to testing this fix and updating this blog post. Thanks again Agustin!