agentleFS
thisrohanguptathisrohangupta/harness-skills/skills/create-trigger/SKILL.md

create-trigger

Skill2 starsChanged 7 months agoApache-2.0Archived repositoryView on GitHub

Generate Harness Trigger YAML for automated pipeline execution and create via MCP. Use when user says "create trigger", "webhook trigger", "cron trigger", "scheduled build", "artifact trigger", or wants pipelines to run automatically.

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Verify payload conditions match actual webhook payloads from the Git provider.

    line 207
  2. Distinctive:

    Verify webhook is registered in Git provider

    line 214
  3. Distinctive:

    Check payload conditions match actual payload

    line 215
  4. Distinctive:

    Ensure connector has correct permissions

    line 216
  5. Very specific:

    Test with harness_get on the trigger to verify config

    line 217
  6. Distinctive:

    Check for overlapping trigger conditions

    line 221
  7. Distinctive:

    Verify cron expression syntax (5 fields, UTC timezone)

    line 224
  8. Distinctive:

    Check pipeline identifier is correct

    line 225
  9. Distinctive:

    Ensure trigger is enabled

    line 226

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create Trigger

Generate Harness Trigger YAML and push to Harness via MCP.

Instructions

  1. Identify trigger type - Webhook (Git events), Scheduled (cron), Artifact (registry updates), or Manifest (Helm chart updates)
  2. Configure conditions - Branch filters, payload conditions, cron expression, or artifact path
  3. Generate YAML using the templates below, referencing the target pipeline
  4. Create via MCP using harness_create with resource_type trigger
  5. Verify webhook registration - For webhook triggers, confirm the webhook is registered in the Git provider

Trigger Types

  • Webhook - GitHub, GitLab, Bitbucket, Azure Repos, Custom
  • Scheduled - Cron-based scheduling
  • Artifact - Docker Hub, ECR, GCR, ACR, Nexus
  • Manifest - Helm chart updates

Webhook Trigger (GitHub)

trigger:
  name: PR Trigger
  identifier: pr_trigger
  orgIdentifier: default
  projectIdentifier: my_project
  pipelineIdentifier: ci_pipeline
  source:
    type: Webhook
    spec:
      type: Github
      spec:
        type: PullRequest
        spec:
          connectorRef: github_connector
          autoAbortPreviousExecutions: true
          payloadConditions:
            - key: targetBranch
              operator: Equals
              value: main
          headerConditions: []
          jexlCondition: ""
          actions:
            - Open
            - Reopen
            - Synchronize
  inputYaml: |
    pipeline:
      identifier: ci_pipeline
      properties:
        ci:
          codebase:
            build:
              type: PR
              spec:
                number: <+trigger.prNumber>

GitHub Event Types

  • Push - Code pushed to branch
  • PullRequest - PR events (Open, Close, Reopen, Synchronize, Edit)
  • IssueComment - PR comments (Create, Edit, Delete)
  • Release - Release events (Create, Publish, Edit)

Webhook Trigger (GitLab)

trigger:
  name: GitLab Push
  identifier: gitlab_push
  pipelineIdentifier: ci_pipeline
  source:
    type: Webhook
    spec:
      type: Gitlab
      spec:
        type: Push
        spec:
          connectorRef: gitlab_connector
          payloadConditions:
            - key: ref
              operator: Contains
              value: main

Scheduled (Cron) Trigger

trigger:
  name: Nightly Build
  identifier: nightly_build
  orgIdentifier: default
  projectIdentifier: my_project
  pipelineIdentifier: ci_pipeline
  source:
    type: Scheduled
    spec:
      type: Cron
      spec:
        expression: "0 2 * * *"    # 2 AM daily
  inputYaml: |
    pipeline:
      identifier: ci_pipeline
      properties:
        ci:
          codebase:
            build:
              type: branch
              spec:
                branch: main

Cron format: <minute> <hour> <day-of-month> <month> <day-of-week>

Artifact Trigger (Docker Registry)

trigger:
  name: New Image Trigger
  identifier: new_image
  pipelineIdentifier: deploy_pipeline
  source:
    type: Artifact
    spec:
      type: DockerRegistry
      spec:
        connectorRef: dockerhub
        imagePath: myorg/myimage
        tag: <+trigger.artifact.build>
  inputYaml: |
    pipeline:
      identifier: deploy_pipeline
      stages:
        - stage:
            identifier: deploy
            spec:
              service:
                serviceRef: my_service

Artifact Source Types

  • DockerRegistry - Docker Hub
  • Ecr - AWS ECR
  • Gcr - Google Container Registry
  • Acr - Azure Container Registry
  • Nexus3Registry - Nexus
  • AmazonS3 - S3 artifacts

Creating via MCP

Call MCP tool: harness_create
Parameters:
  resource_type: "trigger"
  org_id: "<organization>"
  project_id: "<project>"
  body: <trigger YAML>

To list existing triggers:

Call MCP tool: harness_list
Parameters:
  resource_type: "trigger"
  org_id: "<organization>"
  project_id: "<project>"

Payload Conditions

Filter triggers by webhook payload:

payloadConditions:
  - key: targetBranch
    operator: Equals        # Equals, NotEquals, In, NotIn, StartsWith, EndsWith, Contains, Regex
    value: main
  - key: sourceBranch
    operator: StartsWith
    value: feature/

Common keys: sourceBranch, targetBranch, ref, action, tag

Examples

  • "Create a GitHub PR trigger for CI" - Webhook trigger with PullRequest type
  • "Set up nightly builds at 2 AM" - Scheduled trigger with cron
  • "Trigger deploy when new Docker image is pushed" - Artifact trigger with DockerRegistry
  • "Create a release trigger for tags" - Webhook with Push type, tag filter

Performance Notes

  • Verify payload conditions match actual webhook payloads from the Git provider.
  • For cron triggers, double-check the expression — cron uses UTC timezone.
  • Confirm the target pipeline identifier and inputYaml match the pipeline's expected inputs.

Troubleshooting

Trigger Not Firing

  • Verify webhook is registered in Git provider
  • Check payload conditions match actual payload
  • Ensure connector has correct permissions
  • Test with harness_get on the trigger to verify config

Duplicate Executions

  • Enable autoAbortPreviousExecutions for PR triggers
  • Check for overlapping trigger conditions

Cron Not Running

  • Verify cron expression syntax (5 fields, UTC timezone)
  • Check pipeline identifier is correct
  • Ensure trigger is enabled

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.