Reusable GitHub Actions workflow for testing and deploying UiPath coded-agent repositories with the uip CLI.
The workflow is designed for separate agent repositories. Each repo keeps its own input.json, optional Python tests, and output validator, while this repository owns the common CI/CD behavior.
Use .github/workflows/uip-codedagent-ci.yml from an agent repository:
name: UiPath Coded Agent
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
jobs:
coded-agent:
uses: UiPath-LAB-TEC/coded-agent-gh-action/.github/workflows/uip-codedagent-ci.yml@main
with:
agent_root: .
python_version: "3.12"
input_file: input.json
prepare_input_command: uv run python create_test_attachment.py
run_python_tests: false
run_output_validation: true
validation_script: scripts/validate_codedagent_output.py
deploy: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
deploy_target: folder
folder: Shared
version_strategy: source
uipath_organization: ${{ vars.UIPATH_ORGANIZATION }}
uipath_tenant: ${{ vars.UIPATH_TENANT }}
secrets: inheritEach calling agent repository or organization must define:
UIPATH_CLIENT_IDUIPATH_CLIENT_SECRET
The workflow passes these to uip login as environment-backed values:
uip login --client-id env.UIPATH_CLIENT_ID --client-secret env.UIPATH_CLIENT_SECRETPass these through workflow inputs, usually from GitHub repository or organization variables:
uipath_organizationuipath_tenant
Use uipath_authority only for staging, alpha, or Automation Suite identity URLs.
Before tests run, the workflow installs dependencies with uv sync, activates
the generated .venv, and runs:
uip codedagent setup --forceThe default required smoke test is:
uip codedagent run --input-file input.json --output-file codedagent-output.jsonIf entrypoint is supplied, it is inserted between run and --input-file.
If a repo needs to create a fresh test resource after uip login, set
prepare_input_command. It runs from agent_root after login and before the
smoke test:
with:
prepare_input_command: uv run python create_test_attachment.pyPython tests are optional. Enable them per repo:
with:
run_python_tests: true
python_test_command: UIPATH_ACCESS_TOKEN=dummy python -m unittest discoverEach agent repo owns its validator because output schemas differ. The default validator path is:
scripts/validate_codedagent_output.py
The script must accept:
python scripts/validate_codedagent_output.py --output codedagent-output.jsonValidation failures should print a clear error to stderr and exit non-zero.
The workflow writes a GitHub step summary and uploads a codedagent-audit
artifact on every run. The audit artifact contains:
ci-audit.jsonwith non-secret workflow inputs and GitHub run metadata.tool-versions.txtwith Python, uv, Node.js, npm, anduipversions.input-file.txtwith the smoke-test input path, byte size, and SHA-256 hash.codedagent-output.txtwith the output file byte size and SHA-256 hash when the smoke test producescodedagent-output.json.
Deployment runs only when deploy: true and all test steps pass.
Supported targets:
deploy_target: my-workspacedeploy_target: tenantdeploy_target: folderplusfolder: <folder-name>
The workflow uses uip codedagent deploy, which validates, packs, and publishes in one command. It does not run uip codedagent pack separately.
UiPath package feeds reject duplicate package versions.
version_strategy: sourcedeploys the committedpyproject.tomlversion. Duplicate versions fail and should be fixed by a source-controlled version bump.version_strategy: patch-and-commitincrements only the patch version in[project].version, runsuv lock, commits the version files with[skip ci], pushes the commit, then deploys.
For patch-and-commit, the caller workflow needs write permission:
permissions:
contents: writeIf the caller uses a tag such as @v1, also pass the matching support script ref:
with:
workflow_ref: v1