Skip to content

Commit 4d261d5

Browse files
committed
fix docs preview on main, take 2
1 parent 4f1875d commit 4d261d5

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

.github/set_docs_main_preview_url.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
version_id = m.group(1)
2222
preview_url = f'https://{version_id}-{worker_name}.workers.dev'
23-
print('CloudFlare worker preview URL:', preview_url)
23+
print('CloudFlare worker preview URL:', preview_url, flush=True)
2424

2525
gh_headers = {
2626
'Accept': 'application/vnd.github+json',
@@ -42,7 +42,7 @@
4242
})
4343
}
4444
r = httpx.post(deployment_url, headers=gh_headers, json=deployment_data)
45-
print(f'POST {deployment_url} {r.status_code} {r.text}')
45+
print(f'POST {deployment_url} {r.status_code} {r.text}', flush=True)
4646
r.raise_for_status()
4747
deployment_id = r.json()['id']
4848

@@ -53,5 +53,5 @@
5353
'state': 'success',
5454
}
5555
r = httpx.post(status_url, headers=gh_headers, json=status_data)
56-
print(f'POST {status_url} {r.status_code} {r.text}')
56+
print(f'POST {status_url} {r.status_code} {r.text}', flush=True)
5757
r.raise_for_status()

.github/set_docs_pr_preview_url.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
version_id = m.group(1)
2020
preview_url = f'https://{version_id}-{worker_name}.workers.dev'
21-
print('Docs preview URL:', preview_url)
21+
print('Docs preview URL:', preview_url, flush=True)
2222

2323
gh_headers = {
2424
'Accept': 'application/vnd.github+json',
@@ -28,14 +28,14 @@
2828

2929
# now create or update a comment on the PR with the preview URL
3030
if not PULL_REQUEST_NUMBER:
31-
print('Pull request number not set')
31+
print('Pull request number not set', flush=True)
3232
exit(1)
3333

3434
comments_url = f'https://api.github.com/repos/{REPOSITORY}/issues/{PULL_REQUEST_NUMBER}/comments'
3535
r = httpx.get(comments_url, headers=gh_headers)
36-
print(f'{r.request.method} {r.request.url} {r.status_code}')
36+
print(f'{r.request.method} {r.request.url} {r.status_code}', flush=True)
3737
if r.status_code != 200:
38-
print(f'Failed to get comments, status {r.status_code}, response:\n{r.text}')
38+
print(f'Failed to get comments, status {r.status_code}, response:\n{r.text}', flush=True)
3939
exit(1)
4040

4141
comment_update_url = None
@@ -62,11 +62,11 @@
6262
comment_data = {'body': body}
6363

6464
if comment_update_url:
65-
print('Updating existing comment...')
65+
print('Updating existing comment...', flush=True)
6666
r = httpx.patch(comment_update_url, headers=gh_headers, json=comment_data)
6767
else:
68-
print('Creating new comment...')
68+
print('Creating new comment...', flush=True)
6969
r = httpx.post(comments_url, headers=gh_headers, json=comment_data)
7070

71-
print(f'{r.request.method} {r.request.url} {r.status_code}')
71+
print(f'{r.request.method} {r.request.url} {r.status_code}', flush=True)
7272
r.raise_for_status()

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ jobs:
318318
environment:
319319
name: deploy-docs-preview
320320

321+
permissions:
322+
deployments: write
323+
statuses: write
324+
321325
steps:
322326
- uses: actions/checkout@v4
323327

0 commit comments

Comments
 (0)