Add template initialization and project generation workflows#85
Open
Add template initialization and project generation workflows#85
Conversation
When a user creates a repo from this template, an init workflow creates a welcome issue directing them to the setup form. The form collects language, cloud service, project name, and other settings. On submission, a workflow runs cookiecutter, replaces the repo with the generated project (including only the relevant build/test CI workflow), and opens a PR. Also adds build-pipeline.yml to Python and TypeScript template directories so all four languages include a CI workflow in the generated output. https://claude.ai/code/session_01McSGjKq11F4bxQF7zpHyUJ
Users can now specify a custom API endpoint path. If left blank, it falls back to the auto-derived value from the project name. https://claude.ai/code/session_01McSGjKq11F4bxQF7zpHyUJ
There was a problem hiding this comment.
Pull request overview
Adds automation to initialize and configure a repository created from this cookiecutter template via GitHub Issues + GitHub Actions, and introduces language-specific build pipeline workflows in generated projects.
Changes:
- Added template initialization + template setup GitHub Actions workflows to create a setup issue, generate a project via cookiecutter, and open a PR.
- Added a GitHub Issue Form (
Template Setup) to collect project configuration inputs. - Added TypeScript/Python generated-project build workflows and updated cookiecutter configs to copy workflows without Jinja2 rendering.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
typescript/cookiecutter.json |
Prevents Jinja2 from rendering the generated TypeScript build workflow. |
typescript/{{cookiecutter.project_class_name}}/.github/workflows/build-pipeline.yml |
Adds the TypeScript generated-project CI workflow. |
python/cookiecutter.json |
Prevents Jinja2 from rendering the generated Python build workflow. |
python/{{cookiecutter.project_class_name}}/.github/workflows/build-pipeline.yml |
Adds the Python generated-project CI workflow. |
.github/workflows/template-setup.yml |
Implements issue-driven cookiecutter generation, repo replacement, and PR creation. |
.github/workflows/template-init.yml |
Creates the initial “welcome/configure” issue and ensures the label exists. |
.github/ISSUE_TEMPLATE/setup.yml |
Adds the issue form that collects configuration inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Restrict workflow to OWNER/MEMBER/COLLABORATOR author associations - Normalize `_No response_` from optional GitHub form fields - Add input validation/sanitization for required fields (reject path traversal, control chars, shell metacharacters) - Guard repo replacement with checks that PROJECT_CLASS_NAME is non-empty and generated directory exists - Use `cp -a` with `--` instead of `mv` for safer file operations - Use `execFileSync` instead of `execSync` to prevent shell injection - Close the setup issue immediately after PR creation https://claude.ai/code/session_01McSGjKq11F4bxQF7zpHyUJ
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use dedicated validateProjectName() that only allows letters, numbers,
and spaces starting with a letter, ensuring derived CamelCase/snake_case
names always satisfy template hook regex constraints
- Validate endpoint input with lowercase-alphanumeric-hyphens pattern
matching what the cookiecutter pre_gen hooks expect
- Use issue-number-scoped branch names (setup/initial-project-{N})
to avoid conflicts between multiple setup attempts, and remove --force
https://claude.ai/code/session_01McSGjKq11F4bxQF7zpHyUJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds GitHub Actions workflows and issue templates to automate the cookiecutter template setup process. When a repository is created from this template, users can now fill out a form to configure their project, which automatically generates the project structure and creates a pull request with the configured code.
Key Changes
Template Initialization Workflow (
template-init.yml): Runs on first push tomainand creates a welcome issue with a link to the setup form. Ensures thetemplate-setuplabel exists.Template Setup Workflow (
template-setup.yml): Triggered when a "Template Setup" issue is opened with thetemplate-setuplabel. This workflow:Setup Issue Template (
setup.yml): GitHub issue form that collects:Language-Specific Build Pipelines:
build-pipeline.ymlwith Poetry, pytest, ruff linting, and pip-auditbuild-pipeline.ymlwith Node.js, yarn, and npm auditCookiecutter Configuration: Updated
cookiecutter.jsonfiles to excludebuild-pipeline.ymlfrom Jinja2 rendering, preserving GitHub Actions syntax.Implementation Details
The template setup workflow intelligently transforms user input into language-specific naming conventions:
https://claude.ai/code/session_01McSGjKq11F4bxQF7zpHyUJ