> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/internal-developer-portal/use-idp/self-service-workflows/create-workflow/custom-actions.md).

# Configuring Workflow Actions

Learn how to configure actions for your Workflow's backend.

The backend of **Harness IDP workflows** consists of a library of steps and actions that define the workflow logic.

**Workflow Actions** in IDP are integration points with third-party tools that take inputs from workflows and execute specific tasks based on user input. Workflows include built-in actions for fetching content, registering services in the catalog, and creating/publishing Git repositories.

***

## What you will learn from this topic

* **What actions do:** How Workflow Actions connect frontend inputs to backend tasks such as Git publish and Catalog registration.
* **How to define steps:** How `spec.steps` in workflow YAML sets `id`, `name`, `action`, `input`, and `output`.
* **Common action patterns:** How to pass parameters into actions such as triggering a Harness pipeline.

### Define workflow actions <a href="#define-workflow-actions" id="define-workflow-actions"></a>

You can configure the backend using the `spec.steps` field in your YAML configuration. These steps serve as core execution units, triggering actions and orchestrating pipelines. Input details from the frontend are passed to the backend, enabling task execution.

#### YAML syntax <a href="#yaml-syntax" id="yaml-syntax"></a>

```yaml
steps:
  - id: step_id
    name: Step Name
    action: action_name
    input:
      key: value
    output:
      key: value
```

**YAML breakdown**

* `id` – A unique identifier for the step, used to reference it in later steps.
* `name` – A human-readable label for the step.
* `action` – Specifies the workflow action to execute (e.g., trigger:harness-custom-pipeline, publish:github).
* `input` – Defines the parameters required by the action. These vary depending on the action used.

Example (for `trigger:harness-custom-pipeline`):

```yaml
input:
  url: "https://app.harness.io/ng/account/..."
  inputset:
    project_name: ${{ parameters.project_name }}
    github_repo: ${{ parameters.github_repo }}
```

Here, `url` specifies the Harness pipeline, and `inputset` are the parameters provided by the user, to be used as an input for the pipeline mentioned in the URL.

* `output` – Stores results from the action, which can be used in later steps.

Example (for storing a generated file path):

```yaml
output:
  filePath: '{{ steps.generate.outputs.file }}'
```

This allows other steps to reference the generated `filePath`.

### Supported actions <a href="#supported-actions" id="supported-actions"></a>

You can find a list of all registered Workflow actions under:

1. Click on the **three dots** in the top right corner of the **Workflows** page. Select **Installed Actions**.

   <figure><img src="https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-8dee25b5345a058a462236956c2066f56e77e367%2Fsupported-actions-1.png?alt=media" alt=""><figcaption></figcaption></figure>
2. You will be able to see all the supported actions here.

   <figure><img src="https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-950e3dc4f34cad6e8327112f544e539389600087%2Finstalled-actions.png?alt=media" alt=""><figcaption></figcaption></figure>

Let us dive deeper into each supported action.

#### 1. `trigger:harness-custom-pipeline` <a href="#id-1-triggerharness-custom-pipeline" id="id-1-triggerharness-custom-pipeline"></a>

This action triggers a Harness pipeline using a provided URL and user-defined input variables. It supports various pipeline configurations, including:

* [IDP Stage](https://developer.harness.io/internal-developer-portal/use-idp/self-service-workflows/create-workflow/harness-pipeline.md)
* [Deploy Stage](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/add-a-stage#add-a-stage)
* [Custom Stage](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/add-a-stage#add-a-custom-stage) (Harness CD License or Free Tier required)
* [Pipeline Templates](https://developer.harness.io/harness-platform/use-harness-platform/templates/create-pipeline-template)
* [codebase disabled](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/codebase-configuration/create-and-configure-a-codebase#disable-clone-codebase-for-specific-stages) Build Stage (Harness CI License required)

**Example 1: Using inline `inputset`**

```yaml
##Example
...
steps:
  - id: trigger
    name: Creating your React app
    action: trigger:harness-custom-pipeline
    input:
      url: "https://app.harness.io/ng/account/..."
      inputset:
        project_name: ${{ parameters.project_name }}
        github_repo: ${{ parameters.github_repo }}
      apikey: ${{ parameters.token }}
      hidePipelineURLLog: true
    output:
      text:
        - title: Pipeline Execution
          content: "Execution URL: `${{ steps.trigger.output.url }}`"
```

**Example 2: Using a saved input set with `inputSetName`**

```yaml
##Example
...
steps:
  - id: trigger
    name: Creating your React app
    action: trigger:harness-custom-pipeline
    input:
      url: "https://app.harness.io/ng/account/..."
      inputSetName: my_saved_input_set
      apikey: ${{ parameters.token }}
      hidePipelineURLLog: true
    output:
      text:
        - title: Pipeline Execution
          content: "Execution URL: `${{ steps.trigger.output.url }}`"
```

**Inputs**

Here is a list of **inputs** required to use the action:

| Name                          | Title                 | Description                                                                                                                                                                                                                    | Type      |
| ----------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- |
| **url** *(Mandatory)*         | Pipeline URL          | URL of the pipeline you want to execute. Supports `${{ workflowContext.* }}`, `${{ parameters.* }}`, and `${{ steps.* }}` expressions. Go to [Resolve the pipeline URL at runtime](#id-3-resolve-the-pipeline-url-at-runtime). | `string`  |
| **inputset** *(Optional)*     | Pipeline Inputset     | Inline key-value pairs of pipeline runtime inputs. Provide this, or `inputSetName`, or both. At least one is required.                                                                                                         | `object`  |
| **inputSetName** *(Optional)* | Saved Input Set       | Identifier of a saved Harness input set. Provide this, or `inputset`, or both. At least one is required.                                                                                                                       | `string`  |
| **apikey**                    | Harness x-api-key     | Harness Token to Authenticate Pipeline Execution                                                                                                                                                                               | `string`  |
| **apiKeySecret**              | Harness secret        | Harness secret to which contains x-api-key                                                                                                                                                                                     | `string`  |
| **hidePipelineURLLog**        | Hide Pipeline URL     | Parameter to hide pipeline url from the execution logs                                                                                                                                                                         | `boolean` |
| **showOutputVariables**       | Show Output Variables | Parameter to show output variables exported from a pipeline from the execution logs                                                                                                                                            | `boolean` |

{% hint style="info" %}
**Input set requirement**

You must provide at least one of `inputset` or `inputSetName`. If you omit both, the action throws an error and the workflow does not run.
{% endhint %}

Let us dive into these **inputs** in detail:

1. `url`: Pipeline execution URL

> Note: For pipelines using [Git Experience](https://developer.harness.io/harness-platform/use-harness-platform/git-experience/git-experience-overview) make sure your URL includes `branch` and `repoName` e.g., `https://app.harness.io/ng/account/accountID/module/idp/orgs/orgID/projects/projectID/pipelines/pipelineID?repoName=repo-name&branch=branch`

{% hint style="info" %}
You do not need to hardcode the host, account, org, or project in `url`. Harness IDP can resolve them at execution time, so one Workflow YAML works in every environment. Go to [Resolve the pipeline URL at runtime](#id-3-resolve-the-pipeline-url-at-runtime).
{% endhint %}

2. `inputset`: Key-value pairs of pipeline variables

In the YAML **Example 1** above, under `inputset`, values such as `project_name` and `github_repo` are placeholders for pipeline variable names. You can use the reference format `<+pipeline.variables.VARIABLE_NAME>` directly within the `inputset` **key-value pairs**. For example, instead of simply specifying the variable name, you can reference the pipeline variable like this:

```yaml
...
inputset:
  pipeline.variables.project_name: ${{ parameters.project_name }}
  pipeline.variables.github_repo: ${{ parameters.github_repo }}
  ...
...
```

To obtain these references, simply copy the variable path from the Harness Pipeline Studio UI. Make sure to remove `<+` & `>` from the expression copied from UI.

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-93247ed060d6151787ed0acb47d4a04498dc881f%2Fpipeline-variable.png?alt=media)

**Support for stage variables and pipeline templates**

In addition to pipeline variables, you can also reference **stage variables** within the `inputset`. Here’s how each type of variable can be referenced:

* Stage variable reference: `pipeline.stages.STAGE_IDENTIFIER.variables.VARIABLE_NAME`

If you need to reference lower-level variables (such as stage, step group, and step variables) from outside their original scope, you must include the relative path to that variable. For instance, if you want to reference a stage variable from a different stage, you should use the format, `pipeline.stages.originalStageID.variables.variableName`

Instead of the simpler `stage.variables.variableName`. This fully qualified path ensures the correct variable is referenced across stages, step groups, or steps.

```yaml
inputset:
  pipeline.variables.project_name: ${{ parameters.project_name }}
  pipeline.stages.originalStageID.variables.github_repo: ${{ parameters.github_repo }}
```

To obtain these references, simply copy the variable path from the Harness Pipeline Studio UI and remove the special characters `<+` and `>`.

> Note: **This is the only way to reference stage variables and pipelines using templates with variables under `inputset`. Without the fully qualified path, the input will not be valid.**

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-eb8038690aa144d76843b93da7467ff02632d8c8%2Fstage-variable.png?alt=media)

| Variables under `inputset`                                                   | What is Supported                                                                                                                                  |
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Variable name (`variable_name`)                                              | Supported with Pipelines Variables for IDP stage, custom stage and Codebase Disabled build stage along Pipelines **not** containing any templates. |
| Variable name with Fully Qualified Path (`pipeline.variables.variable_name`) | Supported with Pipelines Variables for all supported stages and Pipelines containing any templates.                                                |

3. `inputSetName`: Identifier of a saved input set

Use this to run the pipeline with an input set that is already saved in Harness, instead of passing values inline.

* It accepts the **identifier** of the saved input set, shown as **Id** next to the input set's name in Harness.
* Use it instead of inline `inputset` when you want the pipeline to run with values already saved in Harness.
* At runtime, the action first verifies that the named input set exists. If it does, the pipeline runs through the `inputSetList` API and Harness resolves the full set on its side.
* If the named input set is not found and you also provided inline `inputset` values, the action falls back to the inline values.

See **Example 2** above for a complete workflow step using `inputSetName`.

**How `inputset` and `inputSetName` work together**

| Scenario                                                                  | What happens                                                                                     |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `inputSetName` is provided and found                                      | The pipeline runs through the `inputSetList` API, and Harness resolves the full saved input set. |
| `inputSetName` is provided but not found, and `inputset` is also provided | The action silently falls back to the inline `inputset`.                                         |
| `inputSetName` is provided but not found, and `inputset` is not provided  | The action throws an error and the workflow fails.                                               |
| Neither `inputset` nor `inputSetName` is provided                         | The action throws an error and the workflow fails.                                               |

4. `apikey`: User Session Token

Go to [Authentication](https://developer.harness.io/internal-developer-portal/use-idp/self-service-workflows/workflowyaml.md#authentication) to configure this authentication mode.

* The **user's session token** is used to trigger the Harness Pipeline.
* The user must have **execute permissions** for the underlying pipeline(s) to ensure successful execution.

You can trigger a pipeline in Harness IDP Workflows using the **`user session token`** mode by specifying the **`token`** setup in your **`parameters.properties`** section of the **Workflow YAML**.

**1. Defining the `token` setup:**

This is defined under the `parameter.properties` spec to extract the user session token. This token is then used to execute the pipeline.

{% hint style="warning" %}
The **`token`** property used to fetch the **Harness Auth Token** is hidden on the **Review Step** using **`ui:widget: password`**. However, for this to function correctly in a **multi-page workflow**, the token property must be included under the **first `page`**.

```yaml
parameters:
  - title: <PAGE-1 TITLE>
    properties:
      property-1:
        title: title-1
        type: string
      property-2:
        title: title-2
      token:
        title: Harness Token
        type: string
        ui:widget: password
        ui:field: HarnessAuthToken
  - title: <PAGE-2 TITLE>
    properties:
      property-1:
        title: title-1
        type: string
      property-2:
        title: title-2
        type: string
  - title: <PAGE-n TITLE>  
```

{% endhint %}

```yaml
      token:
        title: Harness Token
        type: string
        ui:widget: password
        ui:field: HarnessAuthToken
```

**2. Referencing the `token` in the `steps` spec of the workflow YAML:**

You will need to reference the **`token`** within the **steps** section using the following format:

```yaml
apikey: ${{ parameters.token }}
```

5. `apiKeySecret`: Harness API Key Secret

Go to [Authentication](https://developer.harness.io/internal-developer-portal/use-idp/self-service-workflows/workflowyaml.md#authentication) to configure this authentication mode.

* A pre-configured **Harness API Key** is used to trigger the Harness Pipeline.
* The user does **not** need direct access to the underlying pipeline(s); however, the API key must have the **execute permissions** for the underlying pipeline(s).

You can also trigger a pipeline in an IDP Workflow using a **pre-configured Harness API Key**. Here is how you can set this up:

* Create a [Harness API Key Secret](https://developer.harness.io/harness-platform/troubleshooting-and-resources/tutorials/add-secrets-manager#create-secrets).
* Store it in [Harness Secret Manager](https://developer.harness.io/harness-platform/use-harness-platform/secrets/secrets-management/harness-secret-manager-overview) or in an external secret manager. Secrets in an external secret manager are resolved through the delegate.
* The secret is supported at any scope: account, organization, or project.
* The secret must have `execute permissions` to the underlying pipeline(s).

**Reference the `secret` in the `steps` spec:**

```yaml
apiKeySecret: ${{ secretId }}
```

Here, `secretId` refers to the identifier of the secret which stores the **Harness API Key**. You can retrieve this `secretId` from the **Harness Secret Manager**.

6. `hidePipelineURLLog`: Boolean to hide logs (optional)
7. `showOutputVariables`: Boolean to display pipeline output variables (optional)

**Outputs**

1. `Title` : Name of the Pipeline.
2. `url` : Execution URL of the Pipeline e.g.: `https://app.harness.io/ng/account/********************/module/idp-admin/orgs/default/projects/communityeng/pipelines/uniteddemo/executions/**********/pipeline?storeType=INLINE`

Once you create the workflow with this Workflow action, you can see the pipeline URL running in the background and executing the flow.

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-69784550160c7d3a9459bc017a6e053734032889%2Fflow-ca-1.png?alt=media)

You can now optionally remove the pipeline URL from the workflow execution logs, for this you need to use the boolean property `hidePipelineURLLog` and set the value as `true`.

```yaml
## Example 
steps:
- id: trigger
    name: Creating your react app
    action: trigger:harness-custom-pipeline
    input:
    url: "Pipeline URL"
    hidePipelineURLLog: true
    inputset:
        project_name: ${{ parameters.project_name }}
    apikey: ${{ parameters.token }}
```

3. You can as well configure the output to display the pipeline [output variables](https://developer.harness.io/harness-platform/use-harness-platform/variables-and-expressions/harness-variables#input-and-output-variables), by setting the `showOutputVariables: true` under `inputs`and adding `output` as shown in the example below:

```yaml
...
## Example 
steps:
  - id: trigger
      ...
      inputset:
          project_name: ${{ parameters.project_name }}
      apikey: ${{ parameters.token }}
      showOutputVariables: true
output:
  text:
    - title: Output Variable
      content: |
        Output Variable **test2** is `${{ steps.trigger.output.test2 }}` 
    - title: Another Output Variable
      content: |
        Output Variable **test1** with fqnPath is `${{ steps.trigger.output['pipeline.stages.testci.spec.execution.steps.Run_1.output.outputVariables.test1'] }}`      
...
```

Only **user defined output variables** are allowed, but you can as well use the system generated variables by assigning them as a new variable under shell script step as displayed below. For e.g. we have mentioned the system generated output as `jira_id` and under **Optional Configuration** added a **test-var** which becomes a user defined output variable and could be displayed as output in the IDP workflows.

<figure><img src="https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-4aafc0d1013e0af78bdc5a6f2c940d0f2dc7a378%2Foutput-variable.png?alt=media" alt=""><figcaption></figcaption></figure>

There are two ways in which you can add the output variable to the template syntax.

1. You can directly mention the output variable name `${{ steps.trigger.output.test2 }}`, here `test2` is the output variable name we created in the pipeline.
2. You can copy the JEXL expression of the output variable and remove the JEXL constructs, `${{ steps.trigger.output['pipeline.stages.testci.spec.execution.steps.Run_1.output.outputVariables.test1'] }}`, here the part `pipeline.stages.testci.spec.execution.steps.Run_1.output.outputVariables.test1` comes from `<+pipeline.stages.testci.spec.execution.steps.Run_1.output.outputVariables.test2>` copied from execution logs.

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-c3c696402bb21dd9e405cf66adc2eff2ec9e9297%2Foutput-variables.png?alt=media)

**Example**

```yaml
...
## Example 
steps:
  - id: trigger
      name: Creating your react app
      action: trigger:harness-custom-pipeline
      input:
      url: "https://app.harness.io/ng/account/..."
      inputset:
          project_name: ${{ parameters.project_name }}
          github_repo: ${{ parameters.github_repo }}
          pipeline.variables.cloud_provider: ${{ parameters.provider }}
          db: ${{ parameters.db }}
          cache: ${{ parameters.cache }}
      apikey: ${{ parameters.token }}
      showOutputVariables: true
output:
  text:
    - title: Output Variable
      content: |
        Output Variable **test2** is `${{ steps.trigger.output.test2 }}` 
    - title: Another Output Variable
      content: |
        Output Variable **test1** with fqnPath is `${{ steps.trigger.output['pipeline.stages.testci.spec.execution.steps.Run_1.output.outputVariables.test1'] }}`      
...
```

#### 2. `trigger:trigger-pipeline-with-webhook` <a href="#id-2-triggertrigger-pipeline-with-webhook" id="id-2-triggertrigger-pipeline-with-webhook"></a>

This Workflow action could be used to trigger a pipeline execution based on the **input-set identifier** and a webhook name. Usually a single deployment pipeline has different input-set as per the environment it is going to be deployed and developers can just specify the input-set ID aligning with the environment name to trigger the deployment pipeline.

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-9166c9c2e86d93e8ea6a9604a4f36edc1139897d%2Finput-set-list.png?alt=media)

Developers need to mention the input set identifier instead of the name in the workflows input, usually identifier are names devoid of any special characters and spaces, e.g., `input set-test` name would have an identifier as `inputsettest`. It is suggested to provide all the available input-set as `enums` in the template to avoid any ambiguity by developers.

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-fce0a4b6a603c1991a40f54c560e3af914e34565%2Finputsetidentifier.png?alt=media)

Here is an example workflow based on this [source](https://github.com/harness-community/idp-samples/blob/main/workflows-ca-inputset.yaml).

![](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-7052ca4a064d1e3583066eae1d8e5c262cc56a4b%2Finput-form-ca.png?alt=media)

**Inputs**

Here is a list on **inputs** used for this action:

| Name                           | Title           | Type     |
| ------------------------------ | --------------- | -------- |
| **url** *(Mandatory)*          | Pipeline URL    | `string` |
| **inputSetName** *(Mandatory)* | Input Set Name  | `string` |
| **triggerName** *(Mandatory)*  | Trigger Name    | `string` |
| **apiKey**                     | Harness API Key | `string` |

**Outputs**

| Name                 | Title                                    |
| -------------------- | ---------------------------------------- |
| **API URL**          | Webhook URL used for execution           |
| **Pipeline Details** | Redirects to the Harness Pipeline Editor |
| **Execution URL**    | Recent executions of the pipeline        |

**Example**

```yaml
steps:
  - id: trigger
    name: Triggering pipeline via webhook
    action: trigger:trigger-pipeline-with-webhook
    input:
      url: "YOUR_PIPELINE_URL"
      inputSetName: ${{ parameters.inputSetName }}
      triggerName: ${{ parameters.triggerName }}
      apiKey: ${{ parameters.token }}
```

#### 3. `harness:create-secret` <a href="#id-3-harnesscreate-secret" id="id-3-harnesscreate-secret"></a>

This action is used to create a secret in Harness.

**Inputs**

Here is a list of **inputs** required to use the action:

| Name                          | Title                   | Description                                          | Type     |
| ----------------------------- | ----------------------- | ---------------------------------------------------- | -------- |
| **projectId** *(Mandatory)*   | Project Identifier      | Project Identifier where secret will be created      | `string` |
| **orgId** *(Mandatory)*       | Organization Identifier | Organization Identifier where secret will be created | `string` |
| **secretValue** *(Mandatory)* | Secret Value            | Secret Value                                         | `string` |
| **apiKey**                    | Harness x-api-key       | Harness Token to Authenticate Secret Creation        | `string` |

**Output**

Here is what we get as an **output** from the action:

| Name         | Title                     | Type     |
| ------------ | ------------------------- | -------- |
| **secretId** | Secret Identifier created | `string` |

#### 4. `harness:delete-secret` <a href="#id-4-harnessdelete-secret" id="id-4-harnessdelete-secret"></a>

This action is used to delete a secret from Harness.

**Inputs**

Here is a list of **inputs** required to use the action:

| Name                        | Title                   | Description                                          | Type     |
| --------------------------- | ----------------------- | ---------------------------------------------------- | -------- |
| **projectId** *(Mandatory)* | Project Identifier      | Project Identifier where secret will be created      | `string` |
| **orgId** *(Mandatory)*     | Organization Identifier | Organization Identifier where secret will be created | `string` |
| **secretId** *(Mandatory)*  | Secret Identifier       | Secret identifier which is to be deleted             | `string` |
| **apikey**                  | Harness x-api-key       | Harness Token to Authenticate Secret Creation        | `string` |

#### 5. `debug:log` <a href="#id-5-debuglog" id="id-5-debuglog"></a>

This action is used to write a message into the log or list all the files in your workspace.

**Inputs**

Here is a list of **inputs** required to use the action:

| Name              | Title                                    | Type      |
| ----------------- | ---------------------------------------- | --------- |
| **message**       | Message to output                        | `string`  |
| **listWorkspace** | List all files in the workspace, if true | `boolean` |
| **extra**         | Extra info                               | `unknown` |

**Example YAML**

**Write a debug message**:

```yaml
steps:
  - action: debug:log
    id: write-debug-line
    name: Write "Hello Harness!" log line
    input:
      message: Hello Harness!
```

**List the workspace directory**:

```yaml
steps:
  - action: debug:log
    id: write-workspace-directory
    name: List the workspace directory
    input:
      listWorkspace: true
```

#### 6. `debug:wait` <a href="#id-6-debugwait" id="id-6-debugwait"></a>

This action is used to add a **waiting period** for certain time.

**Inputs**

Here is a list of **inputs** required to use this action:

| Name             | Title                          | Type     |
| ---------------- | ------------------------------ | -------- |
| **minutes**      | Waiting period in minutes      | `number` |
| **seconds**      | Waiting period in seconds      | `number` |
| **milliseconds** | Waiting period in milliseconds | `number` |

**Example YAML**

```yaml
steps:
  - action: debug:wait
    id: wait-1min
    name: Waiting for 1 minutes
    input:
      minutes: 1
```

### Use cases <a href="#use-cases" id="use-cases"></a>

#### 1. Hide logs <a href="#id-1-hiding-logs" id="id-1-hiding-logs"></a>

To prevent displaying pipeline URLs in workflow execution logs, use `hidePipelineURLLog: true`.

```yaml
steps:
  - id: trigger
    name: Create React App
    action: trigger:harness-custom-pipeline
    input:
      url: "Pipeline URL"
      hidePipelineURLLog: true
      inputset:
        project_name: ${{ parameters.project_name }}
      apikey: ${{ parameters.token }}
```

#### 2. Use parameters as conditions <a href="#id-2-using-parameters-as-conditions" id="id-2-using-parameters-as-conditions"></a>

You can conditionally execute steps based on parameters.

```yaml
steps:
  - id: deploy
    name: Deploy App
    action: trigger:harness-custom-pipeline
    input:
      url: "YOUR_PIPELINE_URL"
      inputset:
        project_name: ${{ parameters.project_name }}
    if: "${{ parameters.environment == 'production' }}"
```

#### 3. Resolve the pipeline URL at runtime <a href="#id-3-resolve-the-pipeline-url-at-runtime" id="id-3-resolve-the-pipeline-url-at-runtime"></a>

The `url` input of `trigger:harness-custom-pipeline` accepts expressions in any segment. A URL copied from [Pipeline Studio](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/overview/pipeline-studio) contains four values that are specific to one environment:

* Harness host
* Account ID
* Organization ID
* Project ID

When you promote a Workflow YAML from, for example, a development account to QA, and then to production, these values change. For example, the same pipeline has a different host and account ID in the development and production accounts:

```
https://acme-dev.harness.io/ng/account/abcd123/all/orgs/default/projects/payments/pipelines/deploy_service/pipeline-studio/?storeType=INLINE
https://acme.harness.io/ng/account/wxyz789/all/orgs/default/projects/payments/pipelines/deploy_service/pipeline-studio/?storeType=INLINE
```

The problem with a hardcoded URL is, every promotion needs a URL edit and a pull request. However, with `workflowContext`, the same Workflow YAML triggers the right pipeline in every environment it runs in:

```
${{ workflowContext.host }}/ng/account/${{ workflowContext.accountId }}/all/orgs/${{ workflowContext.orgId }}/projects/${{ workflowContext.projectId }}/pipelines/deploy_service/pipeline-studio/?storeType=INLINE
```

![Parameterized URL in Workflow](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-0e900630e9e1e1f108246f3c818405b1beb25448%2Fparameterized-url.png?alt=media)

If you promote the Workflow across accounts, the target pipeline must exist in each account. When the URL keeps the pipeline identifier as a literal value, the identifier must match in every account.

**Expressions for the pipeline URL**

Replace each value that changes between environments with an expression, and keep the rest of the URL as is.

| Expression                               | Use when                                                                                                                                   |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `${{ workflowContext.host }}`            | By default. Resolves to the host of the session that launches the Workflow, including `https://`, so do not add a protocol in front of it. |
| `${{ workflowContext.accountId }}`       | By default. Resolves to the account of the session that launches the Workflow.                                                             |
| `${{ workflowContext.orgId }}`           | The pipeline is in the Workflow's own org.                                                                                                 |
| `${{ workflowContext.projectId }}`       | The pipeline is in the Workflow's own project.                                                                                             |
| `${{ parameters.<field> }}`              | The developer chooses the value in the Workflow form, such as the org, project, pipeline, store type, repository, or branch.               |
| `${{ steps['<step-id>'].output.<key> }}` | An earlier step already produces the value, so the form does not need to ask for it.                                                       |

{% hint style="info" %}
`${{ workflowContext.host }}`, `${{ workflowContext.accountId }}`, `${{ workflowContext.orgId }}`, and `${{ workflowContext.projectId }}` are reserved values, and only these field names work. For example, `${{ workflowContext.org }}` does not work, it resolves to an empty value, and the step fails with an "invalid pipeline URL" error.
{% endhint %}

`parameters` works with any field you define under `spec.parameters`, whatever its name or input type. For example, `${{ parameters.target_org }}` from a plain text field fills the org ID as well as `${{ parameters.org }}` from a [`HarnessOrgPicker`](https://developer.harness.io/internal-developer-portal/use-idp/self-service-workflows/create-workflow/flows-input.md#id-2-harnessorgpicker) field. Only `parameters` values appear on the execution **Input** tab.

{% hint style="warning" %}
`workflowContext.orgId` and `workflowContext.projectId` resolve to the Workflow's own org and project, not the ones selected in the developer's browser.
{% endhint %}

**Example 1: Trigger a pipeline in the Workflow's own project**

The Workflow and the `deploy_service` pipeline both live in the `default` org and the `payments` project. The developer enters a service name and nothing else. Harness IDP takes the host and account from the developer's session, and the org and project from the Workflow's `orgIdentifier` and `projectIdentifier`.

```yaml
...
projectIdentifier: payments
orgIdentifier: default
spec:
  parameters:
    - title: Service Details
      required:
        - service_name
      properties:
        token:
          title: Harness Token
          type: string
          ui:widget: password
          ui:field: HarnessAuthToken
        service_name:
          title: Service Name
          type: string
  steps:
    - id: trigger
      name: Trigger the deployment pipeline
      action: trigger:harness-custom-pipeline
      input:
        url: ${{ workflowContext.host }}/ng/account/${{ workflowContext.accountId }}/all/orgs/${{ workflowContext.orgId }}/projects/${{ workflowContext.projectId }}/pipelines/deploy_service/pipeline-studio/?storeType=INLINE
        inputset:
          service_name: ${{ parameters.service_name }}
        apikey: ${{ parameters.token }}
...
```

On the Workflow execution page, click **View Details** on the step to open the pipeline execution. The address bar displays the resolved account, org, and project.

![Harness pipeline execution page with the resolved account, org, and project highlighted in the address bar](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-d35d5a1314799ff819c0fb755f67f8aa5526a8b0%2Fparam-url-pipeline-execution.png?alt=media)

**Example 2: Let developers select the target pipeline**

The Workflow stays in the `payments` project, and the developer selects where the target pipeline lives: the org, project, pipeline identifier, and store type, plus the repository and branch for a remote pipeline. The host and account still come from `workflowContext`. This form triggers any pipeline in the developer's account, and promoting it needs no URL edit.

```yaml
...
spec:
  parameters:
    - title: Target pipeline
      required:
        - service_name
        - org
        - project
        - pipeline
      properties:
        token:
          title: Harness Token
          type: string
          ui:widget: password
          ui:field: HarnessAuthToken
        service_name:
          title: Service Name
          type: string
        org:
          title: Organization
          type: string
          ui:field: HarnessOrgPicker
        project:
          title: Project
          type: string
          ui:field: HarnessProjectPicker
        pipeline:
          title: Pipeline Identifier
          type: string
        branch:
          title: Branch
          type: string
          description: Leave empty for an inline pipeline.
        repoName:
          title: Repository Name
          type: string
          description: Leave empty for an inline pipeline.
        storeType:
          title: Store Type
          type: string
          default: INLINE
          enum:
            - INLINE
            - REMOTE
  steps:
    - id: trigger
      name: Trigger the selected pipeline
      action: trigger:harness-custom-pipeline
      input:
        url: ${{ workflowContext.host }}/ng/account/${{ workflowContext.accountId }}/all/orgs/${{ parameters.org }}/projects/${{ parameters.project }}/pipelines/${{ parameters.pipeline }}/pipeline-studio/?storeType=${{ parameters.storeType }}&repoName=${{ parameters.repoName }}&branch=${{ parameters.branch }}
        inputset:
          service_name: ${{ parameters.service_name }}
        apikey: ${{ parameters.token }}
...
```

Inline pipelines have no repository or branch. For an inline pipeline, leave **Repository Name** and **Branch** empty, and keep **Store Type** set to `INLINE`.

![Workflow form with the Organization and Project pickers, Pipeline Identifier, Branch, Repository Name, and Store Type fields](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-1db7596c50ebd8e2cda1b6c2d52bb3a5663bd402%2Fparam-url-picker-form.png?alt=media)

The **Input** tab of the Workflow execution lists the values the developer provided, and not the host or account.

![Input tab of the Workflow execution listing store type, org, project, service name, and pipeline, with no host or account](https://1305598861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1bzrz9ybUGCcYdvS4u0z%2Fuploads%2Fgit-blob-c7b74c7463789d135f5b974d7b4b5f8164d4b30c%2Fparam-url-execution-input-tab.png?alt=media)

**Use a value from an earlier step**

When an earlier step already produces a value, reference the step output in the URL instead of asking the developer for it. For example, if a step with the ID `resolve-target` outputs a `projectId`:

```yaml
url: ${{ workflowContext.host }}/ng/account/${{ workflowContext.accountId }}/all/orgs/${{ parameters.org }}/projects/${{ steps['resolve-target'].output.projectId }}/pipelines/${{ parameters.pipeline }}/pipeline-studio/?storeType=INLINE
```

Use the bracket form `steps['<step-id>']` when the step ID contains a hyphen.

**Troubleshoot**

<details>

<summary>The step fails with "invalid pipeline URL"</summary>

The Workflow execution fails with an error like:

```
Error: trigger:harness-custom-pipeline: invalid pipeline URL "/ng/account/<accountId>/all/orgs/default/projects/payments/pipelines/deploy_service/pipeline-studio/?storeType=INLINE". Host and account must resolve to an absolute URL such as https://host/ng/account/<accountId>/…
```

The quoted value is the URL after Harness IDP replaced the expressions. A value that starts with `/ng/account/` informs you that the host resolved to an empty value. Check that:

* The URL starts with `${{ workflowContext.host }}`, or with a full host such as `https://app.harness.io`.
* Each expression is spelled exactly as documented. A misspelled expression, such as `${{ workflowContext.hots }}`, does not fail on its own: it resolves to an empty value, and the URL loses that segment.
* Each form field referenced in the URL has a value.

</details>

<details>

<summary>The step fails with "getaddrinfo ENOTFOUND https"</summary>

The URL contains the protocol twice, for example `https://${{ workflowContext.host }}/ng/account/...`. As `workflowContext.host` already includes `https://`, the request goes to a host named `https`. Remove the protocol in front of the expression.

For an inline pipeline, the same error message also lists `branch=null&repoIdentifier=null`. These are empty values for the repository and branch, and they are not the cause of the error.

</details>

<details>

<summary>The step fails with "Does not exist or has been deleted"</summary>

The Workflow execution fails with an error like:

```
Pipeline Execution failed: Pipeline [deploy_service] under Project[payments], Organization [default] doesn't exist or has been deleted.
```

The resolved URL points to a pipeline that the account running the Workflow does not have in that org and project. Check that:

* The URL or the **Pipeline Identifier** field uses the pipeline identifier, not its display name.
* The org and project in the error are the ones you expect. If they are the Workflow's own scope, `workflowContext.orgId` and `workflowContext.projectId` filled them.
* After you promote the Workflow to another account, the pipeline exists in that account with the same org, project, and pipeline identifiers.

</details>

<details>

<summary>The Workflow triggers a pipeline in the wrong org or project</summary>

`workflowContext.orgId` and `workflowContext.projectId` resolve to the org and project the Workflow belongs to, not the scope selected in the developer's browser. If the pipeline lives elsewhere, replace them with `parameters` expressions from form fields, as in the second example above.

</details>

#### Workflow actions usage limitations <a href="#workflow-actions-usage-limitations" id="workflow-actions-usage-limitations"></a>

| **Workflow Actions**                  | **Pipelines and Stages**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| trigger:harness-custom-pipeline       | Supports only [IDP Stage](https://developer.harness.io/internal-developer-portal/use-idp/self-service-workflows/create-workflow/harness-pipeline.md) along with the [Deploy Stage](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/add-a-stage#add-a-stage), [Custom Stage](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/add-a-stage#add-a-custom-stage)(**Available with Harness CD License or Free Tier usage**), Pipelines using [Pipeline Templates](https://developer.harness.io/harness-platform/use-harness-platform/templates/create-pipeline-template) and [codebase disabled](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/codebase-configuration/create-and-configure-a-codebase#disable-clone-codebase-for-specific-stages) **Build Stage(Only Available with Harness CI License)** with [Run step](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/run-step-settings) |
| trigger:trigger-pipeline-with-webhook | Supports all the pipelines with a custom webhook based trigger                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

{% @harness-feedback/feedback %}
