Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specify
bucket-path
when github.head_ref
is not set
In the workflow we're executing the `thesis/gcp-storage-bucket-action@v3.1.0` action. One of its inputs is `bucket-path`, which is an optional input and is used to configure bucket path. If in the workflow step executing the action we don't use the `bucket-path` property, the action will set its `bucket-path` input to the default value which is `.`. This is the value that we want to use when workflow is triggered manually or by merge to main. Previously we thought that setting the action to use `bucket-name: ${{ github.head_ref }}` property would do the trick of using `.` for `workflow_dispatch` and `push` events and using `head_ref` for `pull_request` events (because we thougt the default value will be used when `bucket-name: ` (without a value) is used in the action. But this turned out to not be truth. When we use `bucket-name: ` the behavior is different than when we don't provide the `bucket-name` property at all. In the first case we don't see the `bucket-name` property in the runner's log, in the second case we see the property populated with the default `.` value. Not having `bucket-name` property in the runner results in wrong behavior of the action (order of the inputs gets messed up and the address of bucket gets resolved to gs://<BUCKETNAME>/<BUILDFOLDER>". As a solution we add a `set-bucket-path` step which creates an output which value is either `.` or `github.head_ref`, depending if the latter is configured. We then use this output as value of `bucket-path` parameter of action `thesis/gcp-storage-bucket-action@v3.1.0`. Read more about how runner handles empty values here: actions/runner#924.
- Loading branch information