gh-dot-tmpl
is a GitHub CLI extension that generates the contents of the .github
folder from templates.
It helps in automating and standardizing the setup of GitHub repository configurations.
gh-dot-tmpl
requires the following dependencies:
gh
(GitHub CLI) version 2.51.0 or highergit
version 2.45.2 or higher
Ensure that these dependencies are installed and properly configured before using gh-dot-tmpl
.
gh extension install Syu-fu/gh-dot-tmpl
Upgrade:
gh extension upgrade dot-tmpl
- Generate files from templates:
To generate the contents of the .github
folder from specified templates, use the following command:
gh dot-tmpl [TEMPLATE_NAME1] [TEMPLATE_NAME2] ...
Replace [TEMPLATE_NAME1], [TEMPLATE_NAME2], etc., with the names of the templates you want to use.
Flag | Description |
---|---|
-h, --help | Display help information |
-v, --version | Display version information |
The location for the configuration file is $XDG_CONFIG_HOME/gh-dot-tmpl/config.yaml
.
Below is an example of a configuration file (config.yaml):
templates:
issue:
template_file: ~/.config/gh-dot-tmpl/template/issue.md
output_file: .github/ISSUE_TEMPLATE.md
pr:
template_file: ~/.config/gh-dot-tmpl/template/pullrequest.md
output_file: .github/PULL_REQUEST_TEMPLATE.md
Key | Description |
---|---|
templates | A mapping of template names to their respective template files and output file names. |
template_file | The name of the template file to use. |
output_file | The name of the file to generate. |
Template files should be placed under $XDG_CONFIG_HOME/gh-dot-tmpl/template/
.
Template Replacements The following placeholders can be used in template files and will be replaced accordingly:
Placeholder | Description |
---|---|
{{.Username}} | Replaced with the GitHub username. |
{{.Repository}} | Replaced with the repository name. |
For example, a template file (issue.md) might look like this:
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Information:**
- OS:
- {{.Reponame}} Version:
**Additional context**
Add any other context about the problem here.
We welcome contributions to gh-dot-tmpl! Please see the CONTRIBUTING.md file for guidelines on how to contribute to this project.
Distributed under the MIT License.