run command based on environment variable

bniemyjski's Avatar

bniemyjski

Apr 07, 2016 @ 06:04 PM

Is there a good way to conditionally run command based on an environment variable like skipping pr's
after_test:
  - node_modules\.bin\grunt publish

https://ci.appveyor.com/project/Exceptionless/exceptionless-ui/build/2.4.858

  1. Support Staff 1 Posted by Feodor Fitsner on Apr 07, 2016 @ 06:13 PM

    Feodor Fitsner's Avatar

    Well, it could be something like:

    after_test: 
      - IF "%MyVar%"=="my_value" node_modules\.bin\grunt publish
    
  2. 2 Posted by bniemyjski on Apr 07, 2016 @ 06:19 PM

    bniemyjski's Avatar

    I'm trying to check if its not set. I'm current trying : - IF %APPVEYOR_PULL_REQUEST_NUMBER% LSS 1 node_modules\.bin\grunt publish

  3. 3 Posted by bniemyjski on Apr 07, 2016 @ 06:28 PM

    bniemyjski's Avatar

    IF %APPVEYOR_PULL_REQUEST_NUMBER% LSS 1 node_modules\.bin\grunt publish
    1 was unexpected at this time.

  4. Support Staff 4 Posted by Feodor Fitsner on Apr 07, 2016 @ 06:31 PM

    Feodor Fitsner's Avatar

    Try this one:

    after_test: 
      - IF "%APPVEYOR_PULL_REQUEST_NUMBER%"=="" node_modules\.bin\grunt publish
    
  5. 5 Posted by bniemyjski on Apr 07, 2016 @ 06:48 PM

    bniemyjski's Avatar

    Awesome that worked!

  6. bniemyjski closed this discussion on Apr 11, 2016 @ 09:39 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac