Skip to content

Commit 6b44729

Browse files
konardclaude
andcommitted
Add GitHubStorage template support and usage examples
- Enhance GitHubStorage with CreateRepositoryFromTemplate method - Add comprehensive usage examples and documentation - Support for creating repositories from organizational templates 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f9f4bfe commit 6b44729

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

csharp/Storage/RemoteStorage/GitHubStorage.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,22 @@ public void RemoveLanguageSpecificWorkflowIfFolderDoesNotExist(long repositoryId
360360

361361
#endregion
362362

363+
#region Template
364+
365+
public async Task<Repository> CreateRepositoryFromTemplate(string templateOwner, string templateRepo, string newOwner, string newRepoName, string description = "", bool isPrivate = false)
366+
{
367+
var request = new NewRepositoryFromTemplate(newRepoName)
368+
{
369+
Owner = newOwner,
370+
Description = description,
371+
Private = isPrivate
372+
};
373+
374+
return await Client.Repository.Generate(templateOwner, templateRepo, request);
375+
}
376+
377+
#endregion
378+
363379
#region Organization
364380

365381
#region Member
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Repository Template Examples
2+
3+
This document demonstrates how to use the GitHub bot's repository template creation feature.
4+
5+
## Available Template Types
6+
7+
The bot supports creating repositories from the following templates:
8+
9+
1. **Hello World Template** - Basic "Hello World" project
10+
2. **Console Application Template** - Console application structure
11+
3. **Library Template** - Automatically published library with CI/CD
12+
13+
## Usage
14+
15+
To create a repository from a template, create an issue with one of the following titles and specify the repository name in the issue body:
16+
17+
### Hello World Template
18+
19+
**Issue Title:** `Hello World Template`
20+
21+
**Issue Body:**
22+
```
23+
I need a new hello world project.
24+
25+
repository: my-hello-world-project
26+
```
27+
28+
### Console Application Template
29+
30+
**Issue Title:** `Console App Template`
31+
32+
**Issue Body:**
33+
```
34+
Please create a new console application.
35+
36+
repository: my-console-app
37+
```
38+
39+
### Library Template
40+
41+
**Issue Title:** `Library Template`
42+
43+
**Issue Body:**
44+
```
45+
Create a new library with automatic publishing.
46+
47+
repository: my-awesome-library
48+
```
49+
50+
## Expected Templates
51+
52+
The bot will look for these template repositories in the `linksplatform` organization:
53+
54+
- `linksplatform/Template.HelloWorld`
55+
- `linksplatform/Template.ConsoleApp`
56+
- `linksplatform/Template.Library`
57+
58+
## Bot Response
59+
60+
After processing the request, the bot will:
61+
62+
1. Create a new repository from the specified template
63+
2. Comment on the issue with the new repository URL
64+
3. Close the issue automatically
65+
66+
If there are any errors (e.g., invalid repository name or template not found), the bot will comment with error details and keep the issue open.

0 commit comments

Comments
 (0)