Starting builds automatically with codemagic.yaml #3100
-
If you are looking for help, please confirm the following...
Which mobile framework are you using?Flutter (Dart) Steps to reproduce
My YAML configuration is as follows (simplified for clarity): triggering:
uat_triggering: &uat_triggering
events:
- push
branch_patterns:
# Only trigger when pushing to uat from dev (not direct dev pushes)
- pattern: 'uat'
include: true
source: false
# Exclude direct pushes to dev
- pattern: 'dev'
include: false
source: false
# Include merges from dev to uat
- pattern: 'dev'
include: true
source: true
cancel_previous_builds: true
prd_triggering: &prd_triggering
events:
- push
branch_patterns:
# Only trigger when pushing to main from uat (not direct main pushes)
- pattern: 'main'
include: true
source: false
# Include merges from uat to main
- pattern: 'uat'
include: true
source: true
# Exclude merges from dev to main
- pattern: 'dev'
include: false
source: true
cancel_previous_builds: true
patch_triggering: &patch_triggering
events:
- push
branch_patterns:
# Only trigger when pushing to main from dev (not direct main pushes)
- pattern: 'main'
include: true
source: false
# Exclude direct pushes to dev
- pattern: 'dev'
include: false
source: false
# Include merges from dev to main
- pattern: 'dev'
include: true
source: true
# Exclude merges from uat to main
- pattern: 'uat'
include: false
source: true
cancel_previous_builds: true Expected resultsWhen pushing directly to the dev branch, no workflows should be triggered.
Actual resultsWhen pushing directly to the dev branch, workflows with both uat_triggering and patch_triggering are triggered. I've tried various combinations of include/exclude patterns and source flags, but I haven't been able to prevent workflows from triggering when pushing directly to dev. Build id (optional)No response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @fikretsengul, You're currently using the In your case, I recommend using only Here’s an example:
With this setup:
|
Beta Was this translation helpful? Give feedback.
-
I'm tentatively closing the discussion since we haven't heard back from you. You can open the discussion again by replying to this message or opening a new discussion. |
Beta Was this translation helpful? Give feedback.
Hi @fikretsengul, You're currently using the
push
event trigger, which causes workflows to run on any push — including direct pushes to the dev branch. That’s why you’re seeing unexpected builds.In your case, I recommend using only
pull_request
events and enforcing conditions using thewhen:
clause with attributes from the pull request webhook.Here’s an example:
With this setup: