Downloads a skeleton, templates variables into it, and places the result in the workspace, or in a subdirectory.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| url | string | Relative path or absolute URL pointing to the directory tree to fetch | |
| token | string | An optional token to use for authentication when reading the resources. | |
| values | object | Values to pass on to the templating engine | |
| replace | boolean | If set, replace files in targetPath instead of skipping existing ones. | |
| targetPath | string | Target path within the working directory to download the contents to. Defaults to the working directory root. | |
| trimBlocks | boolean | If set, the first newline after a block is removed (block, not variable tag). | |
| lstripBlocks | boolean | If set, leading spaces and tabs are stripped from the start of a line to a block. | |
| copyWithoutRender | array | An array of glob patterns. Any files or directories which match are copied without being processed as templates. | |
| cookiecutterCompat | boolean | Enable features to maximise compatibility with templates built for fetch:cookiecutter | |
| copyWithoutTemplating | array | An array of glob patterns. Contents of matched files or directories are copied without being processed, but paths are subject to rendering. | |
| templateFileExtension | any | If set, only files with the given extension will be templated. If set to `true`, the default extension `.njk` is used. |
Output Schema
Usage Examples
Fetch a Node service template from GitHub and publish to GitHub
Fetches a Node service skeleton from a GitHub repository, renders variables, and then publishes the generated code to a new GitHub repo using publish:github.
steps:
- id: fetch-base
action: fetch:template
input:
url: https://github.com/acme-org/software-templates/tree/main/skeletons/node-service
values:
component_id: ${{ parameters.component_id }}
owner: ${{ parameters.owner }}
description: ${{ parameters.description }}
system: payments
port: 8080
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=acme-org&repo=${{ parameters.component_id }}
defaultBranch: mainFetch into a subdirectory with controlled templating and publish to GitLab
Downloads a Java Spring skeleton into a subdirectory, skips rendering for binary and static assets, trims template whitespace, and then publishes to GitLab using publish:gitlab.
steps:
- id: fetch-into-dir
action: fetch:template
input:
url: https://gitlab.com/acme/templates/java-spring/-/tree/main/skeleton
targetPath: services/${{ parameters.component_id }}
values:
component_id: ${{ parameters.component_id }}
owner: ${{ parameters.owner }}
java_package: com.acme.payments
port: 8081
copyWithoutRender:
- '**/*.png'
- '**/*.jar'
- 'static/**'
trimBlocks: true
lstripBlocks: true
- id: publish
action: publish:gitlab
input:
repoUrl: gitlab.com?owner=acme&repo=${{ parameters.component_id }}
defaultBranch: mainUse Cookiecutter compatibility to scaffold from a Cookiecutter template
Fetches a Cookiecutter-based template and renders it with Cookiecutter-compatible features enabled. Useful when reusing existing Cookiecutter templates, then publishing with publish:github.
steps:
- id: fetch-cookiecutter
action: fetch:template
input:
url: https://github.com/cookiecutter/cookiecutter-django
cookiecutterCompat: true
targetPath: services/${{ parameters.component_id }}
values:
project_slug: ${{ parameters.component_id }}
project_name: ${{ parameters.name }}
author_name: ${{ parameters.owner }}
email: team@example.com
timezone: UTC
debug: 'n'
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=acme-org&repo=${{ parameters.component_id }}
defaultBranch: mainTemplate only .njk files and skip templating in a Helm chart
Only files with the .njk extension are rendered while Helm chart contents are copied verbatim but filenames are still templated. Existing files in the target path are replaced and the result can then be published with publish:github.
steps:
- id: fetch-partial-templating
action: fetch:template
input:
url: https://github.com/acme-org/templates/tree/main/skeletons/service-with-helm
targetPath: ${{ parameters.component_id }}
templateFileExtension: true
copyWithoutTemplating:
- 'charts/**'
- '**/*.min.js'
values:
component_id: ${{ parameters.component_id }}
owner: ${{ parameters.owner }}
container_image: ghcr.io/acme/${{ parameters.component_id }}:latest
replace: true
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=acme-org&repo=${{ parameters.component_id }}
defaultBranch: mainFetch from a private GitHub Enterprise repo using a token
Downloads a Go service skeleton from a private GitHub Enterprise repository using a token, renders variables, and publishes to the same host with publish:github.
steps:
- id: fetch-private
action: fetch:template
input:
url: https://github.mycompany.com/platform/templates/tree/main/skeletons/go-service
targetPath: services/${{ parameters.component_id }}
token: ${{ secrets.gheToken }}
values:
component_id: ${{ parameters.component_id }}
owner: ${{ parameters.owner }}
description: ${{ parameters.description }}
go_module: github.mycompany.com/acme/${{ parameters.component_id }}
port: 9090
- id: publish
action: publish:github
input:
repoUrl: github.mycompany.com?owner=acme&repo=${{ parameters.component_id }}
defaultBranch: main