Problem using the find command to search through commit messages

justin's Avatar

justin

01 Jul, 2015 12:32 AM

I am attempting to set a flag to publish binaries based on the presence of the string "[publish binary]" in the commit message. When I run the following code on my local machine in a command prompt it works, for some reason when run on appveyor it doesn't, and I don't understand why.

> (echo %APPVEYOR_REPO_COMMIT_MESSAGE% | find "[publish binary]" > nul) && (set PUBLISH_BINARY=true) || (ver > nul)
> echo APPVEYOR_REPO_COMMIT_MESSAGE=%APPVEYOR_REPO_COMMIT_MESSAGE%
APPVEYOR_REPO_COMMIT_MESSAGE=debug commit message [publish binary]
> echo PUBLISH_BINARY=%PUBLISH_BINARY%
PUBLISH_BINARY=false

What I am expecting is for PUBLISH_BINARY=true. It really seems like the "find" app is not working as expected, though that is a pretty basic windows utility. Can anyone help me with this? What am I doing wrong?

My project is EvolveLabs/electron-weak, you should be able to see my script in there.

  1. 1 Posted by justin on 01 Jul, 2015 12:46 AM

    justin's Avatar

    Actually if I remove the > nul after find, then I get this error: FIND: Parameter format not correct

    I'm not sure how that's possible. I'm using it as find "[publish binary]" it doesn't get much simpler than that. Is there some kind of escaping I need to do or something? Again, this exact line of code works for me on windows 8.1.

  2. Support Staff 2 Posted by Feodor Fitsner on 01 Jul, 2015 01:07 AM

    Feodor Fitsner's Avatar

    I'd try using PowerShell for that:

    - ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.contains('[publish binary]')) { $env:PUBLISH_BINARY = 'true' } else { $env:PUBLISH_BINARY = 'false' }
    
  3. 3 Posted by justin on 01 Jul, 2015 02:09 AM

    justin's Avatar

    That did it :)

    I don't understand why the other way didn't work but I'm unblocked. Thanks.

  4. justin closed this discussion on 01 Jul, 2015 02:09 AM.

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