From c89406c8c2c17fccad7e2f667f777ff88ee23f64 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 14 May 2025 16:51:59 -0400 Subject: [PATCH] Refactor lambda_handler: remove manual workflow trigger for initialization, relying on automatic trigger via pull request events --- template_automation/app.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/template_automation/app.py b/template_automation/app.py index ce61a6a..75077d6 100644 --- a/template_automation/app.py +++ b/template_automation/app.py @@ -225,23 +225,8 @@ def lambda_handler(event: dict, context) -> dict: base_branch=default_branch ) - # Optionally trigger initialization workflow - if template_input.trigger_init_workflow: - try: - logger.info(f"Attempting to trigger workflow initialize.yml on branch repo-init in repository {repo_name}") - github.trigger_workflow( - repo_name=repo_name, - workflow_id="initialize.yml", - ref="repo-init" # Using the consistent branch name instead of feature_branch variable - ) - logger.info(f"Successfully triggered initialize.yml workflow in repository {repo_name}") - except requests.exceptions.HTTPError as e: - if e.response.status_code == 404: - logger.warning(f"Workflow initialize.yml not found in repository {repo_name}. This is expected if the repository was created from scratch instead of from a template.") - logger.info("Continuing without triggering workflow...") - else: - logger.error(f"Failed to trigger workflow: {str(e)}") - # Don't raise the exception, allow the function to complete successfully + # The initialize.yml workflow will run automatically when the PR is created + # since it's configured to trigger on pull_request events with repo-init as the head branch return { "repository_url": repo["html_url"],