-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template Repository #7365
Comments
Feature idea: Variable replacement in a template repo's file. For example, variables such as:
These variables could be one-time replaced at creation time. As far as I know, GitHub's template feature does not support such a feature yet. Copying non-git content should be optional. It brings problem of what to do with absolute URLs that point to the template repo itself. Not sure we should even attempt to rewrite those. |
Current readme template already support {Name} and {Description}. I think it should be the same variable replacement for template repos but in all md files (and possibly other file types as well, maybe configurable)
I agree it would be error prone to try to fix URLs, but instead more generic variables could be added to settings. For example the External Issue Tracker URL Format already support placeholders {user}, {repo} and {index}. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Too good idea to be closed. 💚 |
That could be quite a large list (especially for admins). Why not do it how GitHub does, where it's a
I agree with @silverwind that only git content should be copied (at least at first?) |
Wikis and avatars are things that could come from templates as well. I use repo avatars to convey the type of repo it is (e.g. library, utility, firmware related, electronic, mechanical, etc.). IMHO this function could be emulated by a migration from the same instance. The admin/org owner can have as many template repos as they want and clone them by migration gitea-to-gitea. It would be cool if Gitea would let you choose what items not to migrate (e.g. not issues or not teams). |
It can be made searchable, but I agree it is a good idea to at least allow selecting directly on the template repo. It would be good to allow selecting what content you want to copy (or not copy) from the template repo. |
|
@jolheiser I'd add to that list:
|
Some more to make the list complete:
|
|
Regarding the variable replacement, I think there are two possibilities. Either make a new commit with the variables replaced, OR replace every time the markdown is rendered in the UI. Both options have some pros and cons. I prefer the later, but it would not work as well with other git services. |
The replacement would happen at generation time in the same initial commit. |
I don't think branches or releases can be carried over, as both of those rely on commits that won't exist once the repository is generated. A generated repository acts like an initial commit based on the files in the template at the time of generation. It doesn't keep the history of the template repository, as it may have no meaning to the generated project. All of the above can be changed (and made optional) by someone else, however it is not my current intention for this implementation. |
That was not my impression. There can be two possibilities for how a repository is created from a template:
I think the first shall at least be an option! History of the template might be interesting for the created repository or not. However the main point of cloning rather than copying is that if someone later change the template, it will be much easier to merge in those changes later as git keeps track of was what changes since you created from the template. |
That sounds like a fork or migration imo I think we are having different ideas of what a template is and what to use it for. EDIT: I think we are starting to split hairs, but this is a good conversation to clarify how future PRs may (or may not) be implemented. |
In the PR you said something about you shared code from the forking process, so I somehow thought it would be a cloning process :) (I havn't checked the details of the implementation yet). Forking in Gitea (and Github) usually means you intend to contribute back to the original repository. In GitHub I don't think you even can choose to fork to the same user as owns the repository? So I don't think that has the same usage. At least I don't want to keep it as a tracked fork because normally there will be no pull request back to the template. Migration is in my view more used between different sites, even if it is possible within one site. So maybe that is more close to what I expect. My idea of a template is that you can have set up some basic software structure (maybe even a complete rudimentary software) that you use to make other software from. The history can be interesting if you want to know why something was made in a certain way. If someone makes an update to the template, you might want to try merge it back (so that is the opposite way than a normal pull request). |
Oh! That's my bad, I maybe worded it poorly. I agree the history is nice to see, however that's partially what the "generated from x" sub-title is for, since the commit history makes sense for the template (but not necessarily the generated project) This process very closely resembles how GitHub uses templates. (Maybe not code-wise, but in terms of the end result) |
Regarding the copy of all the branches and/or the history, my view is as follows:
I think that copying branches is useful, and I'll give an example to illustrate my idea. Imagine a template (in Gitea from the future! 😄) with:
What I mean is that an org can have all the permissions already set up for the template according to their usual workflow, and when they create the new repo these permissions are carried onto it. Of course this only applies if permissions are copied too. |
@guillep2k I see what you mean now, and I agree. 👍 |
|
Regarding auto-expansion of variables in content, what should all be mapped (and what content should be affected?) I'm thinking git content and git hooks currently. (Probably the wiki in the future as well, but that's almost an entirely separate beast) For mapping, I was thinking of giving it the entire Per @silverwind (modified to match what Anything specific to a repository I would probably also make the same variable available as old and new. |
@jolheiser Could you add #7365 (comment) to you to do list? |
I can, but if I understand it correctly it may not be needed. Currently there are no commits to squash because the newly generated repository abandons the history of the template. |
@lunny Could you add #7365 (comment) to your description so it's easier to jump to what is and isn't implemented yet? |
@jolheiser We need a feature on gitea to transfer an issue's owner. :) Please open a new issue and I will close this one. Let's discuss there. |
Continue on #9126 |
A repository could be a template repository.
This will replace #2062 #7359 .
The text was updated successfully, but these errors were encountered: