diff --git a/git_trigger_flow.py b/git_trigger_flow.py index e69de29..46a3558 100644 --- a/git_trigger_flow.py +++ b/git_trigger_flow.py @@ -0,0 +1,24 @@ +# File: git_trigger_flow.py + +from prefect import flow, get_run_logger + +@flow(name="GitOps Trigger Flow") +def git_triggered_flow(repo_name: str = "unknown repository", commit_sha: str = "unknown commit"): + """ + A simple flow that logs a message indicating it was triggered by a Git push event. + This flow is the target for our GitOps webhook automation. + """ + # get_run_logger() is the standard way to log information in Prefect flows. + # These logs will appear in the `flow.w3ai` UI for the specific flow run. + logger = get_run_logger() + + logger.info("🚀 Hello from the GitOps Trigger Flow!") + logger.info(f"Successfully triggered by an update to repository: {repo_name}") + logger.info(f"Commit SHA: {commit_sha}") + logger.info("✅ The Git-to-Flow pipeline is working!") + + +# This block allows you to run the script directly from the command line for testing. +# It will not be used by the Prefect agent, but it's good practice. +if __name__ == "__main__": + git_triggered_flow(repo_name="w3ai/test-repo", commit_sha="abc123def456") \ No newline at end of file