Skip to content

Commit 1f716c9

Browse files
committed
\Fix docs preview workflow to ensure PR comments are posted\n\nUpdated to match patterns from the successful pr-deploy.yaml workflow:\n- Added job-level pull-requests write permission\n- Added explicit env var for PR_NUMBER\n- Added explicit GITHUB_TOKEN environment variable\n- Added reactions-edit-mode for consistency\n\n\ud83e\udd16 Generated with [Claude Code](https://claude.ai/code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\
1 parent afbdde9 commit 1f716c9

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

.github/workflows/docs-preview.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ on:
77

88
permissions:
99
contents: read
10-
pull-requests: write
1110

1211
jobs:
1312
preview:
1413
name: Generate docs preview
1514
runs-on: ubuntu-latest
15+
permissions:
16+
pull-requests: write # needed for commenting on PRs
1617
steps:
1718
- name: Harden Runner
1819
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
@@ -24,6 +25,16 @@ jobs:
2425
with:
2526
fetch-depth: 0
2627

28+
- name: Get PR info
29+
id: pr_info
30+
run: |
31+
set -euo pipefail
32+
PR_NUMBER=${{ github.event.pull_request.number }}
33+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
34+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
2738
- name: Get changed files
2839
id: changed-files
2940
uses: tj-actions/changed-files@27ae6b33eaed7bf87272fdeb9f1c54f9facc9d99 # v45.0.7
@@ -49,16 +60,19 @@ jobs:
4960
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
5061
id: find-comment
5162
with:
52-
issue-number: ${{ github.event.pull_request.number }}
63+
issue-number: ${{ env.PR_NUMBER }}
5364
comment-author: 'github-actions[bot]'
5465
body-includes: '## 📚 Docs Preview'
66+
direction: last
5567

5668
- name: Create or update preview comment
5769
if: steps.docs-preview.outputs.has_changes == 'true'
5870
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5973
with:
6074
comment-id: ${{ steps.find-comment.outputs.comment-id }}
61-
issue-number: ${{ github.event.pull_request.number }}
75+
issue-number: ${{ env.PR_NUMBER }}
6276
body: |
6377
## 📚 Docs Preview
6478
@@ -77,4 +91,5 @@ jobs:
7791
---
7892
<sub>🤖 This comment is automatically generated and updated when documentation changes.</sub>
7993
edit-mode: replace
80-
reactions: eyes
94+
reactions: eyes
95+
reactions-edit-mode: replace

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy