From 756a80817095ef905b7abc890eaef966f580f6ea Mon Sep 17 00:00:00 2001 From: Kamil Potrec Date: Wed, 10 Sep 2025 14:51:51 +0100 Subject: [PATCH 1/2] fix: use database ids for comments --- scripts/pr_comment.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/pr_comment.py b/scripts/pr_comment.py index 465123b..db6fed0 100644 --- a/scripts/pr_comment.py +++ b/scripts/pr_comment.py @@ -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") @@ -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) @@ -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) From 39eb19f1d09995602afa9feee76d256c68799271 Mon Sep 17 00:00:00 2001 From: Kamil Potrec Date: Wed, 10 Sep 2025 14:52:05 +0100 Subject: [PATCH 2/2] fix: permission to write the changelogs and tags --- .github/workflows/bump-package.yml | 2 ++ .github/workflows/main.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/bump-package.yml b/.github/workflows/bump-package.yml index 62c8c4e..1d140fc 100644 --- a/.github/workflows/bump-package.yml +++ b/.github/workflows/bump-package.yml @@ -15,6 +15,8 @@ on: jobs: bump: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Setup Python uses: actions/setup-python@v5 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0034365..638c543 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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) }}