I have an appveyor.yml
definition which contains the fragment
init:
- ps: $Env:LABEL = If ($Env:APPVEYOR_REPO_TAG) { "Tag" + $Env:APPVEYOR_REPO_TAG_NAME } else { "nontaglabel" }
When later trying to access %LABEL%
, on non-tag commits it contains the plain string "Tag". I expected it to contain the string "nontaglabel".
On tag commits, it contains the expected string Tag with the tag name as a suffix.
How can I assign the environment variable "nontaglabel" to the environment variable on commits that aren't tags?
This is because $Env:APPVEYOR_REPO_TAG
has string value of "false" on non-tag commits. Thus ($Env:APPVEYOR_REPO_TAG)
is evaluated to true
as string value is not null or empty. Please use ($Env:APPVEYOR_REPO_TAG -eq $true)
or ($Env:APPVEYOR_REPO_TAG -eq "true")
-- both will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With