nx-set-shas icon indicating copy to clipboard operation
nx-set-shas copied to clipboard

Add ability to set default BASE_SHA instead of using HEAD~1 if no successful workflow run found

Open Mufasa opened this issue 1 year ago • 3 comments

The current action sets the BASE_SHA to HEAD~1 if it cannot find a successful workflow run. In my specific case, I created a monorepo and checked-in several commits before I got something that could be built successfully.

It would be great if I could either configure this action to use the first commit as the BASE_SHA or specify a default BASE_SHA myself.

Would this be possible?

Mufasa avatar Jul 21 '23 09:07 Mufasa

An alternative might be to also set an environment variable, say LAST_SUCCESSFUL_WORKFLOW_FOUND, to either yes or no (or true/false). We could then use this to reset the BASE_SHA environment variable to whatever SHA we wanted under these conditions.

Mufasa avatar Jul 21 '23 11:07 Mufasa

You can propose a new PR that would introduce a new variable:

fallback_sha: ''

When specified, this would be used as a fallback instead of the HEAD~1

meeroslav avatar Sep 06 '23 11:09 meeroslav

This would be useful also in use case where the 2nd workflow(triggered by workflow_dispatch from 1st workflow) want to check the affected projects from the previous workflow. Currently 2nd workflow always see same sha for both env. Instead of fallback_sha, can we have base_sha?

jmvtrinidad avatar Dec 13 '23 02:12 jmvtrinidad