7
7
8
8
permissions :
9
9
contents : read
10
- pull-requests : write
11
10
12
11
jobs :
13
12
preview :
14
13
name : Generate docs preview
15
14
runs-on : ubuntu-latest
15
+ permissions :
16
+ pull-requests : write # needed for commenting on PRs
16
17
steps :
17
18
- name : Harden Runner
18
19
uses : step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
24
25
with :
25
26
fetch-depth : 0
26
27
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
+
27
38
- name : Get changed files
28
39
id : changed-files
29
40
uses : tj-actions/changed-files@27ae6b33eaed7bf87272fdeb9f1c54f9facc9d99 # v45.0.7
@@ -49,16 +60,19 @@ jobs:
49
60
uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
50
61
id : find-comment
51
62
with :
52
- issue-number : ${{ github.event.pull_request.number }}
63
+ issue-number : ${{ env.PR_NUMBER }}
53
64
comment-author : ' github-actions[bot]'
54
65
body-includes : ' ## 📚 Docs Preview'
66
+ direction : last
55
67
56
68
- name : Create or update preview comment
57
69
if : steps.docs-preview.outputs.has_changes == 'true'
58
70
uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
71
+ env :
72
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59
73
with :
60
74
comment-id : ${{ steps.find-comment.outputs.comment-id }}
61
- issue-number : ${{ github.event.pull_request.number }}
75
+ issue-number : ${{ env.PR_NUMBER }}
62
76
body : |
63
77
## 📚 Docs Preview
64
78
77
91
---
78
92
<sub>🤖 This comment is automatically generated and updated when documentation changes.</sub>
79
93
edit-mode : replace
80
- reactions : eyes
94
+ reactions : eyes
95
+ reactions-edit-mode : replace
0 commit comments