Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/ISSUE_TEMPLATE/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Template Setup
description: Configure your new API project from the cookiecutter template.
title: "Template Setup"
labels: ["template-setup"]
body:
- type: markdown
attributes:
value: |
Welcome! Fill out this form to generate your API project. Once submitted, a workflow will run the cookiecutter template and create a PR with your configured project.

- type: dropdown
id: language
attributes:
label: Language
description: The programming language for your API.
options:
- TypeScript
- "C#"
- Go
- Python
validations:
required: true

- type: dropdown
id: cloud_service
attributes:
label: Cloud Service
description: The cloud platform to deploy your API to.
options:
- Azure Function App
- GCP Cloud Function
- AWS Lambda
validations:
required: true

- type: input
id: project_name
attributes:
label: Project Name
description: The name of your project (e.g. "My Cool API"). Used to derive class names, endpoints, and slugs.
placeholder: My API
validations:
required: true

- type: input
id: project_endpoint
attributes:
label: Endpoint Name
description: "Optional. The base API endpoint path (e.g. \"my-cool-api\"). If left blank, it will be derived from the project name (lowercase, hyphens)."
placeholder: my-api
validations:
required: false

- type: input
id: project_description
attributes:
label: Project Description
description: A short description of your project.
placeholder: This is a template repository for API projects.
validations:
required: false

- type: input
id: author
attributes:
label: Author
description: The author of the project.
placeholder: Your Name
validations:
required: false

- type: dropdown
id: license
attributes:
label: Open Source License
description: The license for your project.
options:
- MIT license
- BSD license
- ISC license
- Apache Software License 2.0
- GNU General Public License v3
- Not open source
validations:
required: true
82 changes: 82 additions & 0 deletions .github/workflows/template-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Template Initialization

on:
push:
branches:
- main

permissions:
issues: write

jobs:
create-setup-issue:
runs-on: ubuntu-latest
steps:
- name: Check if setup issue already exists
id: check
uses: actions/github-script@v7
with:
script: |
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'template-setup',
state: 'all',
});
if (issues.data.length > 0) {
core.setOutput('exists', 'true');
} else {
core.setOutput('exists', 'false');
}

- name: Create setup issue
if: steps.check.outputs.exists == 'false'
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;

// Ensure the template-setup label exists
try {
await github.rest.issues.createLabel({
owner,
repo,
name: 'template-setup',
color: '0075ca',
description: 'Template setup configuration',
});
} catch (e) {
// Label may already exist, that's fine
}

const issueUrl = `https://github.com/${owner}/${repo}/issues/new?template=setup.yml&title=Template+Setup`;

await github.rest.issues.create({
owner,
repo,
title: 'Welcome! Configure your new API project',
labels: ['template-setup'],
body: [
'## Welcome to your new API project! 🎉',
'',
'This repository was created from the [cookiecutter-api](https://github.com/code-and-sorts/cookiecutter-api) template.',
'',
'To set up your project, please fill out the **Template Setup** form:',
'',
`👉 **[Open the Template Setup Form](${issueUrl})**`,
'',
'The form will ask you to select:',
'- **Language** — TypeScript, C#, Go, or Python',
'- **Cloud Service** — Azure Function App, GCP Cloud Function, or AWS Lambda',
'- **Project Name** — Used to derive class names, endpoints, and file names',
'- **License** — The open source license for your project',
'',
'Once you submit the form, a workflow will automatically:',
'1. Generate your project from the cookiecutter template',
'2. Create a pull request with the fully configured project',
'3. Remove all template scaffolding, leaving only your project files',
'',
'You can close this issue after submitting the setup form.',
].join('\n'),
});
Loading