Clone an Azure repository into the workspace directory.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| token | string | The token to use for authorization. | |
| branch | string | The branch to checkout to. | |
| server | string | The hostname of the Azure DevOps service. Defaults to dev.azure.com | |
| remoteUrl | string | The Git URL to the repository. | |
| targetPath | string | The subdirectory of the working directory to clone the repository into. |
Output Schema
Usage Examples
Clone a private Azure DevOps repo alongside a fetched template
This clones a private Azure DevOps repository into a subdirectory while also fetching a starter template with fetch:template. Use this when you scaffold around an existing codebase without overwriting workspace files.
steps:
- id: fetchBase
action: fetch:template
input:
url: ./skeleton
targetPath: .
- id: cloneServiceRepo
action: azure:repo:clone
input:
remoteUrl: https://dev.azure.com/acme/Payments/_git/payments-service
targetPath: service
token: ${{ secrets.azure.token }}Clone a specific branch into a subdirectory for vendor code
This checks out a specific release branch into a vendor folder. Use this to pin dependencies or SDKs at a known version.
steps:
- id: cloneVendorSdk
action: azure:repo:clone
input:
remoteUrl: https://dev.azure.com/acme/Platform/_git/payments-sdk
branch: release/2024-10
targetPath: vendor/payment-sdk
token: ${{ secrets.azure.token }}Clone from a self hosted Azure DevOps Server
This clones from an on premises Azure DevOps Server using a custom hostname. Use this when your repos are hosted outside dev.azure.com.
steps:
- id: cloneLegacyService
action: azure:repo:clone
input:
remoteUrl: https://azure.company.local/DefaultCollection/Manufacturing/_git/LegacyMES
branch: develop
targetPath: legacy-mes
server: azure.company.local
token: ${{ secrets.azure.serverPat }}Clone multiple repositories for a composite build
This clones two repositories into separate subdirectories. Use this to assemble a workspace that combines a service and a shared library.
steps:
- id: cloneSharedLib
action: azure:repo:clone
input:
remoteUrl: https://dev.azure.com/acme/Shared/_git/node-shared-lib
branch: main
targetPath: src/libs/shared
token: ${{ secrets.azure.token }}
- id: cloneInventoryService
action: azure:repo:clone
input:
remoteUrl: https://dev.azure.com/acme/Inventory/_git/inventory-service
branch: main
targetPath: src/services/inventory
token: ${{ secrets.azure.token }}Parameterized clone using user selected repo and branch
This uses template parameters to select the repo, branch, and destination directory at runtime. Use this when the template needs to work with different teams and repositories.
steps:
- id: cloneSelectedRepo
action: azure:repo:clone
input:
remoteUrl: ${{ parameters.repositoryUrl }}
branch: ${{ parameters.branchName }}
targetPath: ${{ parameters.destinationPath }}
token: ${{ secrets.azure.token }}