actions / typescript-action

Create a TypeScript Action with tests, linting, workflow, publishing, and versioning
https://github.com/actions
MIT License
2k stars 473 forks source link

git diff command fails if _dist/_ folder doesn't exist #893

Closed alexquitiaquez closed 5 months ago

alexquitiaquez commented 5 months ago

https://github.com/actions/typescript-action/blob/cebb7a99fe3172ff475be1ca488335e710c873c3/.github/workflows/check-dist.yml#L53

This Git command fails if dist/ folder doesn't exist. it fails with this message, however step execution ends in success anyway,

fatal: ambiguous argument 'dist/': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

I suggest to add a new if condition before, in order to validate the dist/ folder existence and exit with exit 1 if it's not present,

          if [ ! -d dist/ ]; then
            echo "Expected dist/ directory does not exist.  See status below:"
            ls -la ./
            exit 1
          fi
ncalteen commented 5 months ago

Good catch on this! I am checking out your PR now :)