Initializes a git repository of the content in the workspace, and publishes it to Azure.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| token | string | The token to use for authorization to Azure | |
| repoUrl | string | Repository Location | |
| signCommit | boolean | Sign commit with configured PGP private key | |
| sourcePath | string | Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository. | |
| description | string | Repository Description | |
| defaultBranch | string | - | |
| gitAuthorName | string | - | |
| gitAuthorEmail | string | - | |
| gitCommitMessage | string | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| remoteUrl | string | A URL to the repository with the provider | |
| commitHash | string | The git commit hash of the initial commit | |
| repositoryId | string | The Id of the created repository | |
| repoContentsUrl | string | A URL to the root of the repository |
Usage Examples
Publish a new repository to Azure DevOps with default branch and description
Creates a new Azure DevOps repo from the generated workspace and sets the default branch. Use this when scaffolding a new service with a standard main branch. Starts with fetch:template and finishes by registering with catalog:register.
steps:
- id: fetch-base
name: Fetch template content
action: fetch:template
input:
url: ./template
values:
serviceName: ${{ parameters.serviceName }}
owner: ${{ parameters.owner }}
- id: publish
name: Publish to Azure DevOps
action: publish:azure
input:
repoUrl: dev.azure.com?organization=${{ parameters.azureOrg }}&project=${{ parameters.project }}&repo=${{ parameters.repoName }}
description: ${{ parameters.description }}
defaultBranch: main
gitCommitMessage: "chore: scaffold ${{ parameters.serviceName }}"
- id: register
name: Register in catalog
action: catalog:register
input:
location:
type: url
target: ${{ steps.publish.output.repoContentsUrl }}/catalog-info.yamlPublish only a subdirectory as the repository root
Publishes a specific subfolder from the workspace as the repository root. Use this when your template creates multiple components and you want to publish only one service folder.
steps:
- id: fetch-mono
name: Fetch monorepo template
action: fetch:template
input:
url: ./template
values:
repoName: ${{ parameters.repoName }}
project: ${{ parameters.project }}
- id: publish-service
name: Publish service subfolder
action: publish:azure
input:
repoUrl: dev.azure.com?organization=${{ parameters.azureOrg }}&project=${{ parameters.project }}&repo=${{ parameters.repoName }}-api
description: "API service for order processing"
defaultBranch: main
sourcePath: services/api
gitAuthorName: "Backstage Scaffolder"
gitAuthorEmail: "[email protected]"
gitCommitMessage: "feat: initial API service scaffold"
- id: register-service
name: Register API in catalog
action: catalog:register
input:
location:
type: url
target: ${{ steps['publish-service'].output.repoContentsUrl }}/catalog-info.yamlPublish to an on‑prem Azure DevOps Server with an explicit token
Targets a self‑hosted Azure DevOps Server with a custom host and passes a Personal Access Token. Use this when your instance is not dev.azure.com or you need to override the integration token.
steps:
- id: fetch-tpl
name: Fetch template
action: fetch:template
input:
url: ./template
values:
name: ${{ parameters.name }}
owner: ${{ parameters.team }}
- id: publish-ado-server
name: Publish to on-prem Azure DevOps
action: publish:azure
input:
repoUrl: ado.contoso.local?organization=${{ parameters.azureOrg }}&project=${{ parameters.project }}&repo=${{ parameters.repoName }}
description: "Internal service deployed on-prem"
defaultBranch: master
token: ${{ parameters.azurePat }}
gitCommitMessage: "init: scaffold ${{ parameters.name }}"
- id: register-onprem
name: Register component
action: catalog:register
input:
location:
type: url
target: ${{ steps['publish-ado-server'].output.repoContentsUrl }}/catalog-info.yamlPublish with a signed initial commit
Signs the initial commit using a configured PGP key on the runner. Use this when your organization requires signed commits for provenance.
steps:
- id: fetch-src
name: Fetch template
action: fetch:template
input:
url: ./template
values:
component_id: ${{ parameters.componentId }}
owner: ${{ parameters.owner }}
- id: publish-signed
name: Publish with signed commit
action: publish:azure
input:
repoUrl: dev.azure.com?organization=${{ parameters.azureOrg }}&project=${{ parameters.project }}&repo=${{ parameters.componentId }}
description: "Service with signed initial commit"
defaultBranch: main
gitAuthorName: "Platform Engineering"
gitAuthorEmail: "[email protected]"
gitCommitMessage: "chore: initial commit for ${{ parameters.componentId }} signed"
signCommit: true
- id: register-signed
name: Register component
action: catalog:register
input:
location:
type: url
target: ${{ steps['publish-signed'].output.repoContentsUrl }}/catalog-info.yamlPublish to a develop branch from a docs-only subfolder
Starts the repository on a non‑default branch and publishes only the docs folder. Use this when bootstrapping documentation projects or when your main code is managed elsewhere.
steps:
- id: fetch-docs
name: Fetch docs template
action: fetch:template
input:
url: ./template
values:
docsName: ${{ parameters.docsName }}
project: ${{ parameters.project }}
- id: publish-docs
name: Publish docs to Azure DevOps
action: publish:azure
input:
repoUrl: dev.azure.com?organization=${{ parameters.azureOrg }}&project=${{ parameters.project }}&repo=${{ parameters.docsRepo }}
description: "Team documentation"
defaultBranch: develop
sourcePath: docs
gitCommitMessage: "docs: bootstrap ${{ parameters.docsName }}"
- id: register-docs
name: Register docs component
action: catalog:register
input:
location:
type: url
target: ${{ steps['publish-docs'].output.repoContentsUrl }}/catalog-info.yaml