google-github-actions / upload-cloud-storage

A GitHub Action for uploading files to a Google Cloud Storage (GCS) bucket.
https://cloud.google.com/storage
Apache License 2.0
206 stars 49 forks source link

Support action issues a warning instead of fail when no file exist in the given path #332

Closed capri-xiyue closed 1 year ago

capri-xiyue commented 1 year ago

TL;DR

Currently, it will fail when no file exist in the given path with error google-github-actions/upload-cloud-storage failed with: ENOENT: no such file or directory. It will be useful that users have the option to choose whether the action should fail or issue a warning when no file exists.

Detailed design

No response

Additional information

No response

sethvargo commented 1 year ago

Hey @capri-xiyue - I think it would be better to skip the step altogether with an if statement:

- steps:
  - uses: 'google-github-actions/upload-cloud-strorage@v1'
    if: '${{ hashFiles(''./path/*'') == '''' }}'

That is strictly more efficient because then GitHub doesn't even download the action source.