Skip to content

Commit

Permalink
Refactor lambda_handler: remove manual workflow trigger for initializ…
Browse files Browse the repository at this point in the history
…ation, relying on automatic trigger via pull request events
  • Loading branch information
Your Name committed May 14, 2025
1 parent 23b04d5 commit c89406c
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions template_automation/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit c89406c

Please sign in to comment.