> For the complete documentation index, see [llms.txt](https://docs.cortex.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cortex.io/streamline/workflows/scaffolder/convert-template.md).

# Convert a GitHub repo to a Cookiecutter template

If you are using GitHub templates to standardize your service creation, it is possible to convert the templates for use within a [Cortex Workflow](/streamline/workflows.md).

This guide explains how to convert a GitHub repository template into a [Cookiecutter](https://www.cookiecutter.io/) template, enabling a more efficient process when you scaffold the repository from a Workflow.

In this guide, assume the repository has the following structure:

```json
Dockerfile
ReadMe
pipeline.yaml
/App
   |- App.py
```

## How to convert a GitHub template to a Cookiecutter template

1. Clone the existing GitHub repository locally.
2. Create a cookiecutter.json file, including the basic inputs needed from the user, other fields that will be used in the template, and the version (required). For example:

```json
{
	"project_name":"my project",
	"author":"author@example.com",
	"version": 0.1.0
}
```

3. Create a base folder with a name similar to:\
   `{{ cookiecutter.project_name }}`
4. Move the contents of the repo into to folder you created in Step 3. For example:

```json
/{{cookiecutter.project_name}}
    |- Dockerfile
    |- ReadMe
    |- pipeline.yaml
    |- App
         |- App.py
cookiecutter.json
```

5. In each of the files and folders, replace existing fields with the corresponding Cookiecutter fields.
   * For example, a Dockerfile may include the line `MAINTAINER author@example.com`. This can be changed to the following:

```json
MAINTAINER  {{cookiecutter.author}}
```

6. Optionally, add content to the README in the repository to document what the Cookiecutter template does.
   * When [registering a Scaffolder template](/streamline/workflows/scaffolder.md), you can choose whether to display the README in Cortex when running a Scaffolder block in a Workflow.

### Handling existing mustache templating in a repository file

You may have files that already contain mustache templating. In an instance where you do not want these interpreted as Cookiecutter fields, you can escape the curly braces, as described in [Cookiecutter's troubleshooting docs here](https://cookiecutter.readthedocs.io/en/stable/troubleshooting.html?utm_source=chatgpt.com).
