Skip to content

Add template initialization and project generation workflows#85

Open
colbytimm wants to merge 5 commits intomainfrom
claude/template-setup-workflow-84Ccy
Open

Add template initialization and project generation workflows#85
colbytimm wants to merge 5 commits intomainfrom
claude/template-setup-workflow-84Ccy

Conversation

@colbytimm
Copy link
Copy Markdown
Contributor

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 to main and creates a welcome issue with a link to the setup form. Ensures the template-setup label exists.

  • Template Setup Workflow (template-setup.yml): Triggered when a "Template Setup" issue is opened with the template-setup label. This workflow:

    • Parses the issue form to extract language, cloud service, project name, and other configuration
    • Derives naming conventions (kebab-case endpoints, PascalCase class names, snake_case slugs)
    • Runs cookiecutter with the parsed configuration
    • Replaces repository contents with the generated project
    • Creates a pull request with the generated project and closes the setup issue
  • Setup Issue Template (setup.yml): GitHub issue form that collects:

    • Language selection (TypeScript, C#, Go, Python)
    • Cloud service selection (Azure Function App, GCP Cloud Function, AWS Lambda)
    • Project name, description, author, and license
  • Language-Specific Build Pipelines:

    • Python: build-pipeline.yml with Poetry, pytest, ruff linting, and pip-audit
    • TypeScript: build-pipeline.yml with Node.js, yarn, and npm audit
  • Cookiecutter Configuration: Updated cookiecutter.json files to exclude build-pipeline.yml from Jinja2 rendering, preserving GitHub Actions syntax.

Implementation Details

The template setup workflow intelligently transforms user input into language-specific naming conventions:

  • Project names are converted to kebab-case for endpoints, PascalCase for class names, and snake_case for Python slugs
  • The workflow validates language selection and fails gracefully with clear error messages
  • Generated projects are moved to the repository root, removing all template scaffolding
  • The created PR includes a summary table of the configuration used

https://claude.ai/code/session_01McSGjKq11F4bxQF7zpHyUJ

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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

claude and others added 2 commits April 6, 2026 17:30
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants