Variables for template repositories #5336
Replies: 28 comments 19 replies
-
I would love this. I wrote about a workaround for running cookiecutter against a fresh copied template repository here, inspired by Bruno's |
Beta Was this translation helpful? Give feedback.
-
This feature would be really awesome I created 2 templates https://github.com/rochacbruno/python-project-template The only values I can currently read via a hacky workaround is the username, repo name, repo description. If I had more variables I would have created different options for the main template:
I suggest GitHub to allow template creators to place a Once the user clicks on "use this template" github redirects to the actions page with the workflow input form to be filled, then once completed it runs the workflow defined in the same template.yml file. |
Beta Was this translation helpful? Give feedback.
-
And with the possibly of having global templates in the E.g. I'd love to have something like this in my bug_report.md template:
EDIT: This is a different scenario. With global templates in |
Beta Was this translation helpful? Give feedback.
-
Template variables would be a huge help for our application, Cupboard. Ideally, we'd be able to use template variables in combination with actions to enable the following:
Template variables would dramatically boost the capabilities of the templating feature. |
Beta Was this translation helpful? Give feedback.
-
I'm honestly completely surprised this isn't already a feature. I'm having a hard time seeing the point of templates if it doesn't incorporate some basic string replacements. |
Beta Was this translation helpful? Give feedback.
-
This is kind of a pre-requirement to support templates. Would make a such different |
Beta Was this translation helpful? Give feedback.
-
I was in need of this (making multiple repos from a template), so I built a simple version that'll run a nice CLI tool to fill in the blanks and prepare the template. It can also work with GitHub Actions if all the variables you need to fill-in the template are present in Action Contexts (but you can do the same with cookiecutter or any custom script of your own, I feel this might be just a bit simpler). |
Beta Was this translation helpful? Give feedback.
-
This would be a hugely helpful feature. |
Beta Was this translation helpful? Give feedback.
-
This would be extremely helpful to enforce consistency across all repositories within our org. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
+1 Yes please |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, my name is Kimsia and I'm an independent web dev. My day job is that I build Purchase Order processing web app for businesses as a service. My customers include a Fortune 500 company. I have a web app that can help with creating a GitHub repo from a template repository and allows variables. It requires you to login using your GitHub oAuth and allow the Anyone interested to do a beta test, can ping me here. Update: I am done with an alpha version. See the demo videos at this comment It targets cookiecutter as the template syntax to build for. If interest is high, can consider other template syntax as well. Cookiecutter is the only one I am familiar with. Right now, my perfectionist streak is trying to figure out 2 other things before I make it more public:
Limitations when public
Two nice things over GitHub Template Repo
Again, anyone interested, can ping me here. Thank you |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, my name is Kimsia and previously I wrote a comment 2 weeks ago here mentioning that I was halfway with a web version that helps people create a repo from a template with variables. Today, I am done and I have 4 loom videos explaining how it all works. I'm calling it GreenDeploy.
The next thing I am going to do is go through each comment here in this history. If the previous comment is a potential use case, I will use it to demonstrate how GreenDeploy solves it. If it's a similar solution, then I will do a compare and contrast video. Any questions you can reach me here or via the crisp messenger on the main website at GreenDeploy.io Thank you. |
Beta Was this translation helpful? Give feedback.
-
Here's how I'm doing it https://github.com/ImLunaHey/ts-template This replaces the vars in the template files and then does a force push over the repo. See https://github.com/ImLunaHey/ts-template-demo for an example of it. |
Beta Was this translation helpful? Give feedback.
-
Guys, I develop a serverless platform called http://bohr.io (Vercel competitor) that has exactly this feature. At bohr.io it is possible to create templates with environment variables (stored on the platform) that will be replicated when someone uses the template. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to drop a +1 on this! I hope something comes out with relevance to this... |
Beta Was this translation helpful? Give feedback.
-
I just spent a bunch of time trying to build a more streamlined process for our repos and Kubernetes deployments only to find out that this ability doesn't exist. So you end up with a case where Terraform is using the same remote state file. Kind of kill the whole plan. |
Beta Was this translation helpful? Give feedback.
-
@linrongbin16 @julijaciric @johnnycreightonppb @kahirokunn @megumish @ryandutton @LegendaryB |
Beta Was this translation helpful? Give feedback.
-
The template-transformer-and-cleanup GitHub Action is precisely what we need. This action automatically replaces predefined keywords with the new repository's name whenever a repository is created from a template. Moreover, it offers the flexibility to replace any keywords with our custom terms, making it an adaptable solution for various template customization needs. |
Beta Was this translation helpful? Give feedback.
-
btw Have made a template with variables via user-land modules: template-web-component This is Handlebars + node. |
Beta Was this translation helpful? Give feedback.
-
+1 (people asking for reactions are just trying to ignore it easier, how do you filter by reactions again?) |
Beta Was this translation helpful? Give feedback.
-
Idk if GitHub already have something publicly available to track requested features, but FontAwesome have a leaderboard with the requested icons. These statistics are from GitHub issues, and comments and reactions are used to measure the most requested ones. If something like this would be implemented and considered mostly reactions, the issue about this keeping come back would be alleviated. |
Beta Was this translation helpful? Give feedback.
-
It's great to see discussions around enhancing GitHub template repositories with the ability to utilize "variables"! This would indeed simplify the process of creating customized repositories by allowing users to inject metadata dynamically. Why "Variables" in Template Repositories?The ability to use variables would empower developers to quickly scaffold new projects tailored to specific needs, making it easier to maintain consistency across multiple repositories. With metadata passed into the template, users could customize project names, descriptions, authors, and other parameters right at the outset, streamlining the initialization process. Existing SolutionsAs you pointed out, tools like Cookiecutter already provide a robust solution for templating projects via the command line, which showcases how this functionality can significantly improve developer workflows. Additionally, the GitHub Actions example by @rochacbruno demonstrates how to automate aspects of this process using GitHub Actions. This approach not only enhances flexibility but also integrates seamlessly into CI/CD pipelines, promoting best practices right from project creation. ConclusionIntroducing variables in GitHub template repositories would be a logical next step in enhancing the platform's usability. It could significantly reduce setup time and improve the developer experience by making project initialization more intuitive and customizable. I look forward to seeing potential updates in this direction! |
Beta Was this translation helpful? Give feedback.
-
Migrating from isaacs/github#1716
Now that github has template repositories, an obvious next step is to enable "variables" to make it easy to stamp out customized repositories based on a set of metadata passed in to the template.
See https://cookiecutter.readthedocs.io for an example of this in a command line tool.
Found someone doing something similar with Github Actions: https://github.com/rochacbruno/python-project-template/blob/main/.github/workflows/rename_project.yml
Beta Was this translation helpful? Give feedback.
All reactions