From 1a040c0489042d1b0f7c72a8ff031c6ca6101bda Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 3 Jun 2026 03:46:49 +0000 Subject: [PATCH] Forge: Added Jules API deployment trigger script --- scripts/jules_ci_trigger.py | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 scripts/jules_ci_trigger.py diff --git a/scripts/jules_ci_trigger.py b/scripts/jules_ci_trigger.py new file mode 100644 index 00000000..3b1ceb83 --- /dev/null +++ b/scripts/jules_ci_trigger.py @@ -0,0 +1,50 @@ +import os +import sys +import json +import urllib.request +import urllib.error + +# JULES_API_KEY should be passed as an environment variable or an argument +API_KEY = os.environ.get("JULES_API_KEY") +if not API_KEY and len(sys.argv) > 1: + API_KEY = sys.argv[1] + +if not API_KEY: + print("Error: JULES_API_KEY environment variable not set.") + sys.exit(1) + +JULES_ENDPOINT = "https://jules.googleapis.com/v1alpha/sessions" +SOURCE = "sources/github/mrhavens/intellecton" + +payload = { + "prompt": "Test connection: Verify Jules API autonomous CI/CD link to the Intellecton Master Key.", + "sourceContext": { + "source": SOURCE, + "githubRepoContext": { + "startingBranch": "master" + } + }, + "automationMode": "AUTO_CREATE_PR", + "title": "Jules API Connection Test" +} + +req = urllib.request.Request(JULES_ENDPOINT, method="POST") +req.add_header("Content-Type", "application/json") +req.add_header("x-goog-api-key", API_KEY) +data = json.dumps(payload).encode("utf-8") + +print(f"Initiating autonomous Jules session on {SOURCE}...") + +try: + with urllib.request.urlopen(req, data=data) as response: + resp_data = response.read().decode("utf-8") + session_info = json.loads(resp_data) + print("Success! Jules Session Created:") + print(json.dumps(session_info, indent=2)) + print(f"\nSession ID: {session_info.get('id')}") + print("You can now monitor this session via the API or wait for the PR.") +except urllib.error.HTTPError as e: + print(f"HTTP Error: {e.code} - {e.reason}") + print(e.read().decode("utf-8")) +except Exception as e: + print(f"Error connecting to Jules API: {str(e)}")