@@ -62,9 +62,10 @@ def get_existing_comment_id(pr_number: int) -> str | None:
6262 # Also check for release preview header as backup
6363 if (signature in comment_body or
6464 "📦 Release Preview" in comment_body ):
65- comment_id = comment .get ("id" )
65+ # Use databaseId (numeric) instead of id (GraphQL node ID) for REST API
66+ comment_id = comment .get ("databaseId" ) or comment .get ("id" )
6667 if comment_id :
67- print (f"Found existing comment with ID: { comment_id } " )
68+ print (f"Found existing comment with ID: { comment_id } (type: { type ( comment_id ) } ) " )
6869 return str (comment_id )
6970
7071 print ("No existing release preview comment found" )
@@ -136,6 +137,11 @@ def create_or_update_comment(pr_number: int, comment_body: str) -> None:
136137 if not check_gh_cli ():
137138 raise Exception ("gh CLI is not available. Please install GitHub CLI." )
138139
140+ # Get repository info from environment
141+ repo = os .environ .get ("GH_REPO" ) or os .environ .get ("GITHUB_REPOSITORY" )
142+ if not repo :
143+ raise Exception ("Repository not specified. Set GH_REPO or GITHUB_REPOSITORY environment variable." )
144+
139145 # Create temporary file with comment body
140146 with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.md' , delete = False ) as f :
141147 f .write (comment_body )
@@ -147,9 +153,10 @@ def create_or_update_comment(pr_number: int, comment_body: str) -> None:
147153
148154 if existing_comment_id :
149155 print (f"Found existing comment { existing_comment_id } , attempting to update..." )
156+ print (f"Using repository: { repo } " )
150157
151- # Try to update existing comment
152- cmd = ["gh" , "api" , f"repos/{{owner}}/{{ repo} }/issues/comments/{ existing_comment_id } " ,
158+ # Try to update existing comment using gh api
159+ cmd = ["gh" , "api" , f"repos/{ repo } /issues/comments/{ existing_comment_id } " ,
153160 "--method" , "PATCH" , "--field" , f"body=@{ temp_file } " ]
154161
155162 exit_code , stdout , stderr = run_command (cmd )
0 commit comments