Skip to content

Commit 16343ff

Browse files
Merge pull request #2 from keycardai/fix/workflows
Fix/workflows
2 parents 1e361c7 + 39eb19f commit 16343ff

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/bump-package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ on:
1515
jobs:
1616
bump:
1717
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
1820
steps:
1921
- name: Setup Python
2022
uses: actions/setup-python@v5

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
bump-packages:
4444
if: needs.detect-changes.outputs.changed-packages != '[]' && !startsWith(github.event.head_commit.message, 'bump:')
4545
needs: detect-changes
46+
permissions:
47+
contents: write
4648
strategy:
4749
matrix:
4850
package: ${{ fromJson(needs.detect-changes.outputs.changed-packages) }}

scripts/pr_comment.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)