Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/bump-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
jobs:
bump:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Setup Python
uses: actions/setup-python@v5
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
bump-packages:
if: needs.detect-changes.outputs.changed-packages != '[]' && !startsWith(github.event.head_commit.message, 'bump:')
needs: detect-changes
permissions:
contents: write
strategy:
matrix:
package: ${{ fromJson(needs.detect-changes.outputs.changed-packages) }}
Expand Down
15 changes: 11 additions & 4 deletions scripts/pr_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ def get_existing_comment_id(pr_number: int) -> str | None:
# Also check for release preview header as backup
if (signature in comment_body or
"📦 Release Preview" in comment_body):
comment_id = comment.get("id")
# Use databaseId (numeric) instead of id (GraphQL node ID) for REST API
comment_id = comment.get("databaseId") or comment.get("id")
if comment_id:
print(f"Found existing comment with ID: {comment_id}")
print(f"Found existing comment with ID: {comment_id} (type: {type(comment_id)})")
return str(comment_id)

print("No existing release preview comment found")
Expand Down Expand Up @@ -136,6 +137,11 @@ def create_or_update_comment(pr_number: int, comment_body: str) -> None:
if not check_gh_cli():
raise Exception("gh CLI is not available. Please install GitHub CLI.")

# Get repository info from environment
repo = os.environ.get("GH_REPO") or os.environ.get("GITHUB_REPOSITORY")
if not repo:
raise Exception("Repository not specified. Set GH_REPO or GITHUB_REPOSITORY environment variable.")

# Create temporary file with comment body
with tempfile.NamedTemporaryFile(mode='w', suffix='.md', delete=False) as f:
f.write(comment_body)
Expand All @@ -147,9 +153,10 @@ def create_or_update_comment(pr_number: int, comment_body: str) -> None:

if existing_comment_id:
print(f"Found existing comment {existing_comment_id}, attempting to update...")
print(f"Using repository: {repo}")

# Try to update existing comment
cmd = ["gh", "api", f"repos/{{owner}}/{{repo}}/issues/comments/{existing_comment_id}",
# Try to update existing comment using gh api
cmd = ["gh", "api", f"repos/{repo}/issues/comments/{existing_comment_id}",
"--method", "PATCH", "--field", f"body=@{temp_file}"]

exit_code, stdout, stderr = run_command(cmd)
Expand Down