Create triggers
In Harness, you can create triggers to automatically run your CI/CD pipelines in response to push events in your Harness Code repos.
Currently, Harness Code triggers must be configured in the YAML editor.
Go to the pipeline where you want to add a trigger for a Harness Code repository.
Make sure your Harness Code repo is the pipeline's default codebase.
Select Triggers in the Pipeline Studio header.
Select New Trigger, and select the Custom trigger type.
Enter a trigger Name and then switch to the YAML editor.
Replace the
source
andinputYaml
sections with the following:source:
type: Webhook
spec:
type: Harness
spec:
type: Push
spec:
autoAbortPreviousExecutions: true
payloadConditions: []
headerConditions: []
repoName: ## Provide your Harness Code repository name.
actions: []
inputYaml: |
pipeline:
identifier: ## Provide the same value as 'pipelineIdentifier'.
properties:
ci:
codebase:
build:
type: branch
spec:
branch: <+trigger.branch>Save the trigger.
To test the trigger, create a PR or push a change to your Code repository.