Auto-promote on pull request to main

I’d like to run a pipeline when I open a pull request in to my main branch. I’m having a hard time parsing the docs on how to write the auto_promote condition to do that. Any tips?

Hi @bismark,

Of note here is that depending on your project configuration, Semaphore 2.0 can trigger 2 different workflows to build pull requests. When only branches are built the best approach to auto_promote a pipeline would be setting up a convention for prefixing pull request branches, for instance “pr-” and write the promotion rules based on that:

auto_promote:
  when:  branch =~ '^pr-.*' AND result = 'passed'

When building pull requests is enabled, Semaphore 2.0 will trigger another workflow based on a merge commit of the pull request branch into its parent branch. If you are opening pull requests only against your main branch, for this type of workflow you can use this rule:

auto_promote:
  when: pull_request =~ '.*' AND result = 'passed'

Let me know if you had something else in mind, I’d be happy to assist further.