UiPath Documentation
uipath-cli
2026.10
false
UiPath CLI user guide

CI/CD recipe: GitHub Actions

Complete GitHub Actions workflow for authenticating, packing, publishing, deploying a UiPath Solution, and running Test Manager tests.

This page gives you a complete .github/workflows/deploy.yml that installs the CLI, authenticates with an External Application, packs and publishes a UiPath Solution, deploys it to Orchestrator, and runs a Test Manager suite against the deployment. Drop it into your repo, add two secrets, and it runs.

For the underlying principles — auth, caching, tool pre-install, version pinning — see How-to: deploy to Orchestrator from CI. This page focuses on the GitHub Actions syntax.

To review pull requests with a coding agent before they reach this pipeline, see CI/CD recipe: agentic pull request review.

Prerequisites​

Before copying the YAML below:

  1. Create an External Application in UiPath with the OR.* scopes your pipeline needs. See Authentication — Flow 2.
  2. Store the secrets in the repository (or organization/environment) settings:
    • Settings → Secrets and variables → Actions → New repository secret.
    • Add UIPATH_CLIENT_ID and UIPATH_CLIENT_SECRET as secrets.
    • Add UIPATH_TENANT as a variable (not a secret — it is not sensitive).
    • For the exact UI steps, the equivalent gh commands, and when to use a secret rather than a variable, see Configure the repository.
  3. Commit a frozen .uipath/config.json at the repository root. The pipeline reads the CLI, tool, and skills versions from it. See Freezing a CI pipeline.
  4. Provision a Test Manager project and test set if you want the test job. Put TEST_SET_KEY (e.g. PROJECT:42) and PROJECT_KEY in the repo variables. See How-to: run tests from the CLI.

.github/workflows/deploy.yml​

name: Deploy UiPath Solution

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:

env:
  NODE_VERSION:     '22'
  SOLUTION_NAME:    'my-solution'
  DEPLOYMENT_NAME:  'my-solution'   # the deployment's identity: keep it the same on every run
  SOLUTION_DIR:     './my-solution'
  OUTPUT_DIR:       './dist'

jobs:

  build:
    name: Pack Solution
    runs-on: ubuntu-latest
    outputs:
      solution_version: ${{ steps.version.outputs.version }}
    steps:

      - uses: actions/checkout@v4

      - name: Compute version
        id: version
        run: echo "version=1.2.0-ci.${{ github.run_number }}" >> "$GITHUB_OUTPUT"

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Cache npm global (@uipath/cli)
        uses: actions/cache@v4
        with:
          path: ~/.npm-global/lib/node_modules
          key:  uip-${{ hashFiles('.uipath/config.json') }}-${{ runner.os }}

      - name: Install UiPath CLI
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$HOME/.npm-global"
          npm config set prefix "$HOME/.npm-global"
          echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
          export PATH="$HOME/.npm-global/bin:$PATH"

          CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli") || exit 1
          if ! command -v uip >/dev/null; then
            npm install -g "@uipath/cli@$CLI_PIN"
          fi
          uip update
          uip --version

      - name: Pack Solution
        id: pack
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$OUTPUT_DIR"
          uip solution pack "$SOLUTION_DIR" "$OUTPUT_DIR" \
            --name "$SOLUTION_NAME" \
            --version "${{ steps.version.outputs.version }}"
          ARTIFACT=$(find "$OUTPUT_DIR" -maxdepth 1 -name "*.zip" | head -1)
          echo "artifact=$ARTIFACT" >> "$GITHUB_OUTPUT"

      - uses: actions/upload-artifact@v4
        with:
          name: solution-zip
          path: ${{ steps.pack.outputs.artifact }}

  deploy:
    name: Publish and deploy
    needs: build
    if: github.event_name != 'pull_request'   # pull requests pack only; they never touch the tenant
    runs-on: ubuntu-latest
    environment: uipath-prod   # attach approval gates here if needed
    steps:

      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Cache npm global (@uipath/cli)
        uses: actions/cache@v4
        with:
          path: ~/.npm-global/lib/node_modules
          key:  uip-${{ hashFiles('.uipath/config.json') }}-${{ runner.os }}

      - name: Install UiPath CLI
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$HOME/.npm-global"
          npm config set prefix "$HOME/.npm-global"
          echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
          export PATH="$HOME/.npm-global/bin:$PATH"

          CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli") || exit 1
          if ! command -v uip >/dev/null; then
            npm install -g "@uipath/cli@$CLI_PIN"
          fi
          uip update

      - uses: actions/download-artifact@v4
        with:
          name: solution-zip
          path: ${{ env.OUTPUT_DIR }}

      - name: Authenticate
        shell: bash
        env:
          UIPATH_CLIENT_ID:     ${{ secrets.UIPATH_CLIENT_ID }}
          UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
          UIPATH_TENANT:        ${{ vars.UIPATH_TENANT }}
        run: |
          set -euo pipefail
          uip login \
            --client-id env.UIPATH_CLIENT_ID \
            --client-secret env.UIPATH_CLIENT_SECRET \
            --tenant "$UIPATH_TENANT"

      - name: Publish to tenant feed
        shell: bash
        run: |
          set -euo pipefail
          ARTIFACT=$(find "$OUTPUT_DIR" -maxdepth 1 -name "*.zip" | head -1)
          uip solution publish "$ARTIFACT"

      - name: Deploy to Orchestrator
        shell: bash
        run: |
          set -euo pipefail
          uip solution deploy run \
            --name "$DEPLOYMENT_NAME" \
            --package-name "$SOLUTION_NAME" \
            --package-version "${{ needs.build.outputs.solution_version }}" \
            --folder-name MySolution \
            --parent-folder-path Shared

  test:
    name: Run Test Manager suite
    needs: deploy
    if: ${{ vars.TEST_SET_KEY != '' }}
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Cache npm global (@uipath/cli)
        uses: actions/cache@v4
        with:
          path: ~/.npm-global/lib/node_modules
          key:  uip-${{ hashFiles('.uipath/config.json') }}-${{ runner.os }}

      - name: Install CLI and authenticate
        shell: bash
        env:
          UIPATH_CLIENT_ID:     ${{ secrets.UIPATH_CLIENT_ID }}
          UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
          UIPATH_TENANT:        ${{ vars.UIPATH_TENANT }}
        run: |
          set -euo pipefail
          mkdir -p "$HOME/.npm-global"
          npm config set prefix "$HOME/.npm-global"
          echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
          export PATH="$HOME/.npm-global/bin:$PATH"

          CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli") || exit 1
          if ! command -v uip >/dev/null; then
            npm install -g "@uipath/cli@$CLI_PIN"
          fi
          uip update

          uip login \
            --client-id env.UIPATH_CLIENT_ID \
            --client-secret env.UIPATH_CLIENT_SECRET \
            --tenant "$UIPATH_TENANT"

      - name: Launch, wait, verify
        shell: bash
        env:
          TEST_SET_KEY: ${{ vars.TEST_SET_KEY }}
          PROJECT_KEY:  ${{ vars.PROJECT_KEY }}
        run: |
          set -euo pipefail

          EXECUTION_ID=$(uip tm testsets run \
            --test-set-key "$TEST_SET_KEY" \
            --output-filter "ExecutionId" \
            --output plain)

          echo "started execution $EXECUTION_ID"

          code=0
          uip tm wait \
            --execution-id "$EXECUTION_ID" \
            --project-key "$PROJECT_KEY" \
            --timeout 1800 || code=$?

          if [ "$code" -eq 4 ]; then
            echo "::error::test run did not finish within 30 minutes"
            exit 4
          fi

          uip tm report get \
            --execution-id "$EXECUTION_ID" \
            --project-key "$PROJECT_KEY"

          FAILED=$(uip tm report get \
            --execution-id "$EXECUTION_ID" \
            --project-key "$PROJECT_KEY" \
            --output-filter "Failed" \
            --output plain)

          if [ "$FAILED" -gt 0 ]; then
            echo "::error::$FAILED test case(s) failed"
            exit 1
          fi

          if [ "$code" -ne 0 ]; then
            echo "::error::wait failed or the run was cancelled (exit $code)"
            exit "$code"
          fi
name: Deploy UiPath Solution

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:

env:
  NODE_VERSION:     '22'
  SOLUTION_NAME:    'my-solution'
  DEPLOYMENT_NAME:  'my-solution'   # the deployment's identity: keep it the same on every run
  SOLUTION_DIR:     './my-solution'
  OUTPUT_DIR:       './dist'

jobs:

  build:
    name: Pack Solution
    runs-on: ubuntu-latest
    outputs:
      solution_version: ${{ steps.version.outputs.version }}
    steps:

      - uses: actions/checkout@v4

      - name: Compute version
        id: version
        run: echo "version=1.2.0-ci.${{ github.run_number }}" >> "$GITHUB_OUTPUT"

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Cache npm global (@uipath/cli)
        uses: actions/cache@v4
        with:
          path: ~/.npm-global/lib/node_modules
          key:  uip-${{ hashFiles('.uipath/config.json') }}-${{ runner.os }}

      - name: Install UiPath CLI
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$HOME/.npm-global"
          npm config set prefix "$HOME/.npm-global"
          echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
          export PATH="$HOME/.npm-global/bin:$PATH"

          CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli") || exit 1
          if ! command -v uip >/dev/null; then
            npm install -g "@uipath/cli@$CLI_PIN"
          fi
          uip update
          uip --version

      - name: Pack Solution
        id: pack
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$OUTPUT_DIR"
          uip solution pack "$SOLUTION_DIR" "$OUTPUT_DIR" \
            --name "$SOLUTION_NAME" \
            --version "${{ steps.version.outputs.version }}"
          ARTIFACT=$(find "$OUTPUT_DIR" -maxdepth 1 -name "*.zip" | head -1)
          echo "artifact=$ARTIFACT" >> "$GITHUB_OUTPUT"

      - uses: actions/upload-artifact@v4
        with:
          name: solution-zip
          path: ${{ steps.pack.outputs.artifact }}

  deploy:
    name: Publish and deploy
    needs: build
    if: github.event_name != 'pull_request'   # pull requests pack only; they never touch the tenant
    runs-on: ubuntu-latest
    environment: uipath-prod   # attach approval gates here if needed
    steps:

      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Cache npm global (@uipath/cli)
        uses: actions/cache@v4
        with:
          path: ~/.npm-global/lib/node_modules
          key:  uip-${{ hashFiles('.uipath/config.json') }}-${{ runner.os }}

      - name: Install UiPath CLI
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$HOME/.npm-global"
          npm config set prefix "$HOME/.npm-global"
          echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
          export PATH="$HOME/.npm-global/bin:$PATH"

          CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli") || exit 1
          if ! command -v uip >/dev/null; then
            npm install -g "@uipath/cli@$CLI_PIN"
          fi
          uip update

      - uses: actions/download-artifact@v4
        with:
          name: solution-zip
          path: ${{ env.OUTPUT_DIR }}

      - name: Authenticate
        shell: bash
        env:
          UIPATH_CLIENT_ID:     ${{ secrets.UIPATH_CLIENT_ID }}
          UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
          UIPATH_TENANT:        ${{ vars.UIPATH_TENANT }}
        run: |
          set -euo pipefail
          uip login \
            --client-id env.UIPATH_CLIENT_ID \
            --client-secret env.UIPATH_CLIENT_SECRET \
            --tenant "$UIPATH_TENANT"

      - name: Publish to tenant feed
        shell: bash
        run: |
          set -euo pipefail
          ARTIFACT=$(find "$OUTPUT_DIR" -maxdepth 1 -name "*.zip" | head -1)
          uip solution publish "$ARTIFACT"

      - name: Deploy to Orchestrator
        shell: bash
        run: |
          set -euo pipefail
          uip solution deploy run \
            --name "$DEPLOYMENT_NAME" \
            --package-name "$SOLUTION_NAME" \
            --package-version "${{ needs.build.outputs.solution_version }}" \
            --folder-name MySolution \
            --parent-folder-path Shared

  test:
    name: Run Test Manager suite
    needs: deploy
    if: ${{ vars.TEST_SET_KEY != '' }}
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Cache npm global (@uipath/cli)
        uses: actions/cache@v4
        with:
          path: ~/.npm-global/lib/node_modules
          key:  uip-${{ hashFiles('.uipath/config.json') }}-${{ runner.os }}

      - name: Install CLI and authenticate
        shell: bash
        env:
          UIPATH_CLIENT_ID:     ${{ secrets.UIPATH_CLIENT_ID }}
          UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
          UIPATH_TENANT:        ${{ vars.UIPATH_TENANT }}
        run: |
          set -euo pipefail
          mkdir -p "$HOME/.npm-global"
          npm config set prefix "$HOME/.npm-global"
          echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
          export PATH="$HOME/.npm-global/bin:$PATH"

          CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli") || exit 1
          if ! command -v uip >/dev/null; then
            npm install -g "@uipath/cli@$CLI_PIN"
          fi
          uip update

          uip login \
            --client-id env.UIPATH_CLIENT_ID \
            --client-secret env.UIPATH_CLIENT_SECRET \
            --tenant "$UIPATH_TENANT"

      - name: Launch, wait, verify
        shell: bash
        env:
          TEST_SET_KEY: ${{ vars.TEST_SET_KEY }}
          PROJECT_KEY:  ${{ vars.PROJECT_KEY }}
        run: |
          set -euo pipefail

          EXECUTION_ID=$(uip tm testsets run \
            --test-set-key "$TEST_SET_KEY" \
            --output-filter "ExecutionId" \
            --output plain)

          echo "started execution $EXECUTION_ID"

          code=0
          uip tm wait \
            --execution-id "$EXECUTION_ID" \
            --project-key "$PROJECT_KEY" \
            --timeout 1800 || code=$?

          if [ "$code" -eq 4 ]; then
            echo "::error::test run did not finish within 30 minutes"
            exit 4
          fi

          uip tm report get \
            --execution-id "$EXECUTION_ID" \
            --project-key "$PROJECT_KEY"

          FAILED=$(uip tm report get \
            --execution-id "$EXECUTION_ID" \
            --project-key "$PROJECT_KEY" \
            --output-filter "Failed" \
            --output plain)

          if [ "$FAILED" -gt 0 ]; then
            echo "::error::$FAILED test case(s) failed"
            exit 1
          fi

          if [ "$code" -ne 0 ]; then
            echo "::error::wait failed or the run was cancelled (exit $code)"
            exit "$code"
          fi

Walkthrough​

build job​

  • actions/checkout@v4 checks out the repository, which holds the frozen .uipath/config.json. The CLI reads that file from the current folder upward, so every job that runs uip checks out the repository first.
  • actions/setup-node@v4 pins Node to the major version specified by NODE_VERSION. The CLI requires Node 22+.
  • actions/cache@v4 caches the npm global node_modules directory, keyed on the hash of .uipath/config.json and the runner OS. When the cache hits, the install step's if ! command -v uip guard skips the npm install.
  • Install step configures a user-local npm prefix (no sudo needed on GitHub-hosted runners), adds it to GITHUB_PATH so later steps see the uip command, and installs the CLI at the version in versions.cli. uip update then puts the CLI and each pinned tool on their pins — no explicit uip tools install is needed. See Freezing a CI pipeline.
  • Pack step invokes uip solution pack with an explicit --version built from github.run_number (monotonic, unique per run in the repo). The step captures the produced .zip path with find rather than hardcoding the filename — keeps the recipe stable across CLI naming-convention changes.
  • actions/upload-artifact@v4 uploads the captured .zip so the deploy job can download it in the next run.
  • outputs.solution_version propagates the computed version to the deploy job — the simplest way to share a value between jobs in the same workflow.

deploy job​

  • Checks out the repository and re-installs the CLI — needs: build forces the job order, but each job runs on a fresh runner, with no repository and no CLI. The cache should hit on the second install.
  • actions/download-artifact@v4 pulls the solution-zip into $OUTPUT_DIR.
  • Authenticate step passes secrets via the step's env: block, then uip login reads them through the env. prefix. The env.VAR_NAME prefix is the supported way to keep a secret out of the command line — see Authentication — the env.VAR_NAME prefix. Do not write --client-secret "${{ secrets.UIPATH_CLIENT_SECRET }}" — that embeds the value into the rendered command and into the step log.
  • Publish + deploy steps use uip solution publish and uip solution deploy run. The deployment is keyed on --name, so DEPLOYMENT_NAME stays the same on every run:
    • The first run creates the deployment and its folder, Shared/MySolution.
    • Every later run upgrades that same deployment in place to the new version. The folder and the provisioned resources stay, and values already set on them (for example a credential asset's secret) are kept. --folder-name and --parent-folder-path apply only to the first run.
    • Do not put github.run_number or a commit SHA in --name. Each new name is a new deployment, and because the folder name is already taken, Orchestrator creates MySolution 1, MySolution 2, and so on: one folder per run.
    • Under the client-credentials login this pipeline uses, the CLI's "already deployed" check only warns; it does not stop the run.
    • Once the deployment exists, uip solution deploy upgrade --name "$DEPLOYMENT_NAME" --package-name "$SOLUTION_NAME" --version <version> does the same upgrade. Unlike deploy run, it fails when no deployment has that name, instead of creating one. See deploy upgrade.
    • If you add --config-file, keep only the resources you change in the file. Each resource the file names is applied as written on every run, so a file straight from deploy config get sets those resources back to the package defaults.
  • if: github.event_name != 'pull_request' limits pull-request runs to the build job. Without it, every pull request would upgrade the production deployment to unmerged code. To deploy pull requests, give each one its own deployment name in a test tenant: see A copy per pull request.
  • environment: uipath-prod ties the job to a deployment environment. Environments are where you configure required reviewers, wait timers, and deployment branches — keep them in the UI and leave the YAML declarative.

test job​

Runs only if the TEST_SET_KEY repo variable is set — the if: guard skips it otherwise. The shell block is the canonical launch → wait → verify pattern from How-to: run tests from the CLI:

  1. uip tm testsets run launches and returns an ExecutionId.
  2. uip tm wait blocks until terminal state. Exit 4 means timeout on wait, and exit 1 means a test failed or the run was cancelled; the outcome is reported via ::error:: so it surfaces in the Actions UI.
  3. uip tm report get reads Data.Failed and the step exits 1 when anything failed.

Common variations​

Promote across environments​

Add a second deploy job that depends on the first, with different secrets:

  deploy-stage:
    needs: build
    environment: uipath-stage
    # …same steps as `deploy`, using ${{ secrets.UIPATH_STAGE_CLIENT_ID }} etc.

  deploy-prod:
    needs: deploy-stage
    environment: uipath-prod    # add "Required reviewers" in the environment settings
    # …same steps as `deploy`, using ${{ secrets.UIPATH_PROD_CLIENT_ID }} etc.
  deploy-stage:
    needs: build
    environment: uipath-stage
    # …same steps as `deploy`, using ${{ secrets.UIPATH_STAGE_CLIENT_ID }} etc.

  deploy-prod:
    needs: deploy-stage
    environment: uipath-prod    # add "Required reviewers" in the environment settings
    # …same steps as `deploy`, using ${{ secrets.UIPATH_PROD_CLIENT_ID }} etc.

Approval gates live in the environment settings — the needs: chain enforces order. See How-to: pack and publish a Solution — promote one package across tenants.

Rollback​

Add a workflow_dispatch input and a guarded job that upgrades the existing deployment back to a specific version. It uses deploy upgrade --name rather than deploy run: deploy upgrade never creates a deployment, so a mistyped name fails instead of installing a fresh copy in a new folder:

on:
  workflow_dispatch:
    inputs:
      rollback_version:
        description: 'Version to roll back to (e.g. 1.1.9)'
        required: false
        type: string

jobs:
  rollback:
    if: ${{ github.event.inputs.rollback_version != '' }}
    runs-on: ubuntu-latest
    # …install + auth…
    steps:
      - name: Roll back to previous version
        run: |
          set -euo pipefail
          uip solution deploy upgrade \
            --name "$DEPLOYMENT_NAME" \
            --package-name "$SOLUTION_NAME" \
            --version "${{ github.event.inputs.rollback_version }}"
on:
  workflow_dispatch:
    inputs:
      rollback_version:
        description: 'Version to roll back to (e.g. 1.1.9)'
        required: false
        type: string

jobs:
  rollback:
    if: ${{ github.event.inputs.rollback_version != '' }}
    runs-on: ubuntu-latest
    # …install + auth…
    steps:
      - name: Roll back to previous version
        run: |
          set -euo pipefail
          uip solution deploy upgrade \
            --name "$DEPLOYMENT_NAME" \
            --package-name "$SOLUTION_NAME" \
            --version "${{ github.event.inputs.rollback_version }}"

deploy upgrade preserves the deployment's existing configuration — asset/credential values already set on it aren't reset to package defaults. Any published version of the package is accepted, including an older one. Extend the deploy job's guard to if: github.event_name != 'pull_request' && github.event.inputs.rollback_version == '', so a rollback run does not also deploy the new build to the same deployment.

Trigger with Actions → Deploy UiPath Solution → Run workflow and enter the rollback version. For destructive rollback (uninstall + solution packages delete), see How-to: pack and publish a Solution — rollback.

A separate copy per run​

For short-lived side-by-side copies (for example a preview copy per run in a test tenant), vary the folder name together with the deployment name, so each copy gets a folder you can recognize instead of MySolution 1, MySolution 2:

          uip solution deploy run \
            --name "${DEPLOYMENT_NAME}-${{ github.run_number }}" \
            --package-name "$SOLUTION_NAME" \
            --package-version "${{ needs.build.outputs.solution_version }}" \
            --folder-name "MySolution-${{ github.run_number }}" \
            --parent-folder-path Shared \
            --yes
          uip solution deploy run \
            --name "${DEPLOYMENT_NAME}-${{ github.run_number }}" \
            --package-name "$SOLUTION_NAME" \
            --package-version "${{ needs.build.outputs.solution_version }}" \
            --folder-name "MySolution-${{ github.run_number }}" \
            --parent-folder-path Shared \
            --yes

--yes skips the "already deployed" check, since a second copy is the intent here. Nothing removes these copies: uninstall each one when you are done with it, with uip solution deploy uninstall.

A copy per pull request​

To review a pull request on a running copy, deploy it under a name and folder of its own in a test tenant, and uninstall that copy when the pull request closes. The name stays the same for the life of the pull request: its first run creates the copy, and every later push updates that copy in place.

Add this job to deploy.yml:

  deploy-pr:
    name: Deploy this pull request's copy
    needs: build
    # Pull requests from this repository only: GitHub gives no secrets to a fork's pull request.
    if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    environment: uipath-pr-preview   # its secrets and UIPATH_TENANT point at a test tenant
    concurrency:
      group: uipath-pr-${{ github.event.pull_request.number }}
      cancel-in-progress: false
    steps:
      # …same checkout, install, download, authenticate and publish steps as `deploy`…

      - name: Deploy to Orchestrator
        shell: bash
        run: |
          set -euo pipefail
          uip solution deploy run \
            --name "${DEPLOYMENT_NAME}-pr-${{ github.event.pull_request.number }}" \
            --package-name "$SOLUTION_NAME" \
            --package-version "${{ needs.build.outputs.solution_version }}" \
            --folder-name "MySolution-pr-${{ github.event.pull_request.number }}" \
            --parent-folder-path Shared \
            --yes
  deploy-pr:
    name: Deploy this pull request's copy
    needs: build
    # Pull requests from this repository only: GitHub gives no secrets to a fork's pull request.
    if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    environment: uipath-pr-preview   # its secrets and UIPATH_TENANT point at a test tenant
    concurrency:
      group: uipath-pr-${{ github.event.pull_request.number }}
      cancel-in-progress: false
    steps:
      # …same checkout, install, download, authenticate and publish steps as `deploy`…

      - name: Deploy to Orchestrator
        shell: bash
        run: |
          set -euo pipefail
          uip solution deploy run \
            --name "${DEPLOYMENT_NAME}-pr-${{ github.event.pull_request.number }}" \
            --package-name "$SOLUTION_NAME" \
            --package-version "${{ needs.build.outputs.solution_version }}" \
            --folder-name "MySolution-pr-${{ github.event.pull_request.number }}" \
            --parent-folder-path Shared \
            --yes

Then add the cleanup as its own workflow, .github/workflows/pr-cleanup.yml, so closing a pull request does not also run the build job:

name: Remove the pull request's UiPath copy

on:
  pull_request:
    types: [ closed ]
    branches: [ main ]

env:
  NODE_VERSION:     '22'
  DEPLOYMENT_NAME:  'my-solution'

jobs:
  cleanup:
    if: github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    environment: uipath-pr-preview
    concurrency:
      group: uipath-pr-${{ github.event.pull_request.number }}
      cancel-in-progress: false
    steps:
      # …same checkout, install and authenticate steps as `deploy`…

      - name: Uninstall this pull request's copy
        shell: bash
        run: |
          set -euo pipefail
          uip solution deploy uninstall \
            "${DEPLOYMENT_NAME}-pr-${{ github.event.pull_request.number }}" \
            --yes
name: Remove the pull request's UiPath copy

on:
  pull_request:
    types: [ closed ]
    branches: [ main ]

env:
  NODE_VERSION:     '22'
  DEPLOYMENT_NAME:  'my-solution'

jobs:
  cleanup:
    if: github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    environment: uipath-pr-preview
    concurrency:
      group: uipath-pr-${{ github.event.pull_request.number }}
      cancel-in-progress: false
    steps:
      # …same checkout, install and authenticate steps as `deploy`…

      - name: Uninstall this pull request's copy
        shell: bash
        run: |
          set -euo pipefail
          uip solution deploy uninstall \
            "${DEPLOYMENT_NAME}-pr-${{ github.event.pull_request.number }}" \
            --yes
  • The pull request number in --name and --folder-name gives each pull request its own deployment and its own folder, for example Shared/MySolution-pr-42. The deploy job keeps deploying production under DEPLOYMENT_NAME. --yes skips the "already deployed" check, since the test tenant is expected to hold other pull requests' copies of the package.
  • environment: uipath-pr-preview holds the test tenant's UIPATH_CLIENT_ID, UIPATH_CLIENT_SECRET and UIPATH_TENANT. An environment's secrets and variables take precedence over the repository's ones of the same name, so the copied steps log in to the test tenant unchanged. Never point this environment at the production tenant.
  • The head.repo check skips pull requests from forks. They get no secrets, so their login would fail.
  • concurrency runs one deploy or cleanup at a time per pull request, across both workflows. While an operation on a deployment runs, the server refuses another deploy under that name.
  • The cleanup runs when the pull request closes, merged or not. uip solution deploy uninstall removes the copy's resources and its folder, and cannot be undone. When the pull request has no copy to remove (for example, its first deploy never finished), the cleanup run fails, and the command's Instructions say why.

Skip tests​

Set (or leave unset) the TEST_SET_KEY repo variable. The if: ${{ vars.TEST_SET_KEY != '' }} guard skips the whole job.

Common pitfalls​

  • ${{ secrets.X }} interpolation. It substitutes at the step-rendering layer. If you put a secret into a run: command line directly, the value becomes part of the rendered script — and the step log, unless GitHub masks it. Always route secrets through env: and read them with env.VAR_NAME inside uip.
  • $GITHUB_PATH vs $PATH. Exporting PATH=… in one step does not carry to the next. Use echo "…" >> "$GITHUB_PATH" to persist a PATH addition across steps on the same runner.
  • strict shell options. Start every multi-line run: with set -euo pipefail — without it, a failed uip solution pack can be followed by a "successful" publish of a stale artifact. See Scripting patterns — strict shell options.
  • Cache false-positives. If the cache key does not change when the freeze changes, the runner restores the old CLI and tools, and uip update reinstalls them on every run. The key in this YAML hashes .uipath/config.json for this reason.
  • Cache path is coupled to the npm prefix. The cache block uses ~/.npm-global/lib/node_modules, which only works because the install step runs npm config set prefix "$HOME/.npm-global". If you change the prefix (e.g. on a self-hosted Windows runner where the convention is %APPDATA%\npm\node_modules), both the cache path: and the npm config set prefix line must move together. On a non-ubuntu-latest runner, dump the real path first with - run: npm root -g and mirror whatever it reports.

See also​

Was this page helpful?

Connect

Need help? Support(opens in new window)

Want to learn? UiPath Academy(opens in new window)

Have questions? UiPath Forum(opens in new window)

Stay updated