Conditional configuration based on commit message?

v0idnull's Avatar

v0idnull

20 May, 2018 03:46 AM

I would like to always test, but only deploy if commit message contains "[deploy]" in it.

The documentation isn't very clear to me. Does commit message filtering affect the entire build? If not, how would I write the configuration to meet the requirement.

If so, is there some way where I can do something like always run tests, but only deploy if commit message contains "[deploy]" in it?

thanks in advance

  1. Support Staff 1 Posted by Ilya Finkelshte... on 21 May, 2018 06:33 PM

    Ilya Finkelshteyn's Avatar

    Your assumption is correct, commit filtering affects entire build. Please check this YAML sample on how to make it conditionally for deployment only.

    install:
    - ps: if ($env:APPVEYOR_REPO_COMMIT_MESSAGE.Contains("[deploy]")) {$env:RUN_DEPLOYMENT = "true"}
    deploy:
    - provider: <provider_name>
      <provider_settings>
      on:
        RUN_DEPLOYMENT: true
    

    The same can be done with UI.

    More details on conditional deployment here.

    You can use APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED environment variable if your keyword is after line break in commit message (can happen with multiple squashed commits).

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:28 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