Skip to content

Conversation

@httpdss
Copy link
Owner

@httpdss httpdss commented Aug 2, 2025

Summary

This PR implements issue #71 by refactoring the scripts/github-trigger.py Python script into a reusable prompt template following the project's template-driven approach.

Changes Made

Removed

  • scripts/github-trigger.py - Standalone Python script for triggering GitHub workflows

Added

  • struct_module/contribs/github/prompts/workflow-trigger.yaml - New prompt template

New Prompt Template Features

The new workflow-trigger.yaml prompt template provides comprehensive guidance for creating GitHub workflow automation scripts, including:

  • Complete Implementation Guidance: Step-by-step instructions for creating workflow trigger scripts
  • Security Best Practices: Token management, error handling, and validation patterns
  • Template Variables: Configurable elements like organization name, topic filter, and workflow filename
  • Example Code Structure: Complete Python script template with proper patterns
  • Error Handling Scenarios: Comprehensive coverage of common failure cases
  • Dependencies and Installation: Clear requirements and setup instructions
  • Usage Examples: Command-line usage patterns and best practices

Benefits

  • Consistency: Aligns with the project's template-driven approach
  • Flexibility: Users can customize trigger logic for their specific needs
  • Maintainability: Reduces direct code dependencies in the scripts folder
  • Reusability: Makes the pattern available for other projects using STRUCT
  • Better Documentation: Provides comprehensive guidance instead of just example code

Template Usage

Users can now generate GitHub workflow trigger scripts using:

struct generate github/prompts/workflow-trigger /path/to/project

This will create a .github/prompts/workflow-trigger.prompt.md file with comprehensive instructions for creating automation scripts.

Validation

  • Follows existing prompt template structure and patterns
  • Maintains all functionality from the original script
  • Includes comprehensive documentation and examples
  • Provides security best practices and error handling guidance
  • Supports the template-driven architecture of the project

Resolves

Closes #71


Note: This change moves from providing a specific implementation to providing comprehensive guidance for creating implementations, which better aligns with STRUCT's template-based approach and allows for greater customization and reuse.

- Remove scripts/github-trigger.py
- Add struct_module/contribs/github/prompts/workflow-trigger.yaml
- Convert standalone Python script to reusable prompt template
- Follow existing prompt template structure and patterns
- Provide comprehensive guidance for GitHub workflow automation
- Include security best practices and error handling guidance
- Support template-driven approach for better maintainability

Resolves #71
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.74%. Comparing base (4d6a1b1) to head (aa63552).
⚠️ Report is 2 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
+ Coverage   66.04%   68.74%   +2.69%     
==========================================
  Files          22       23       +1     
  Lines        1240     1331      +91     
  Branches      175      181       +6     
==========================================
+ Hits          819      915      +96     
+ Misses        384      374      -10     
- Partials       37       42       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

httpdss added 3 commits August 1, 2025 21:34
- Remove GitHub Trigger Script section from docs/github-integration.md
- Clean up script usage examples and troubleshooting info
- Maintain focus on GitHub Actions integration
- Keep best practices and FAQ sections intact
…ration

- Move from github/prompts/workflow-trigger.yaml to prompts/run-struct-trigger.yaml
- Simplify content to focus on MCP-based GitHub automation
- Target specific 'struct-enabled' topic and 'run-struct' workflow
- Add github_organization template variable for configurability
- Create more focused, actionable prompt for AI assistants with MCP capabilities
- Replace hardcoded 'struct-enabled' with {{@ topic @}} template variable
- Add topic variable with string type and descriptive text
- Set 'struct-enabled' as default value for backward compatibility
- Increase template flexibility for different repository topics
@httpdss httpdss added patch enhancement New feature or request good first issue Good for newcomers labels Aug 2, 2025
@httpdss httpdss merged commit 21f19d5 into main Aug 2, 2025
3 checks passed
@httpdss httpdss deleted the feature/refactor-github-trigger-to-prompt branch August 2, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature good first issue Good for newcomers patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor github-trigger.py script into a GitHub workflow prompt template

3 participants