Search code examples
node.jsappveyor

Appveyor different pipes build vs pr


As AppVeyor does not pass secure env variables to PR builds. How can you split the the yml file to do different things. Such as on a PR build I only want to run test_scripts. On branch on master I want it to run the build_scripts as to make artifacts.

I tried

   branches
    only:
     - master

but I can't seem to run build_scripts specifically there.

Basically on a merge into master I do a yarn release that builds the exe. But right now a PR build it runs test_scripts and build_scripts

I'm building a Node project in appveyor specific to windows.


Solution

  • You can use APPVEYOR_PULL_REQUEST_NUMBER environment variable in your script logic. For example IF ($env:APPVEYOR_PULL_REQUEST_NUMBER) will evaluate to false in non-pr build.

    For a full list of built-in environment valuables please look here