Skip to content

Commit 27760e2

Browse files
committed
Merge branch 'simplified-docs-preview' into test-gh-action-parameters
2 parents 6560cd7 + 1f716c9 commit 27760e2

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)