4
4
types : [opened, synchronize, reopened]
5
5
paths :
6
6
- ' docs/**'
7
+ - ' **.md'
8
+ - ' .github/docs/**'
9
+ - ' .github/workflows/docs-preview.yaml'
7
10
8
11
permissions :
9
12
contents : read
10
13
11
14
jobs :
12
- preview :
13
- name : Generate docs preview
15
+ # Extract PR information for the unified workflow
16
+ prepare :
17
+ name : Extract PR Information
14
18
runs-on : ubuntu-latest
15
- permissions :
16
- pull-requests : write # needed for commenting on PRs
19
+ outputs :
20
+ pr_number : ${{ steps.pr_info.outputs.pr_number }}
17
21
steps :
18
- - name : Harden Runner
19
- uses : step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
20
- with :
21
- egress-policy : audit
22
-
23
- - name : Checkout
24
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25
- with :
26
- fetch-depth : 0
27
-
28
22
- name : Get PR info
29
23
id : pr_info
30
24
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
-
38
- - name : Get changed files
39
- id : changed-files
40
- uses : tj-actions/changed-files@v45
41
- with :
42
- files : |
43
- docs/**
44
-
45
- - name : Debug changed files
46
- run : |
47
- echo "All changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
48
- echo "JSON format: ${{ steps.changed-files.outputs.all_changed_files_json }}"
49
-
50
- - name : Check if manifest changed
51
- id : manifest-check
52
- run : |
53
- echo "changed=${{ contains(steps.changed-files.outputs.all_changed_files, 'docs/manifest.json') }}" >> $GITHUB_OUTPUT
54
-
55
- - name : Generate docs preview
56
- id : docs-preview
57
- uses : ./.github/docs/actions/docs-preview
58
- with :
59
- github-token : ${{ secrets.GITHUB_TOKEN }}
60
- changed-files : ${{ steps.changed-files.outputs.all_changed_files_json }}
61
- manifest-changed : ${{ steps.manifest-check.outputs.changed }}
62
-
63
- - name : Debug outputs
64
- run : |
65
- echo "Has changes: ${{ steps.docs-preview.outputs.has_changes }}"
66
- echo "URL: ${{ steps.docs-preview.outputs.url }}"
67
- echo "Changed files:"
68
- echo "${{ steps.docs-preview.outputs.changed_files }}"
69
-
70
- - name : Find existing comment
71
- if : steps.docs-preview.outputs.has_changes == 'true'
72
- uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
73
- id : find-comment
74
- with :
75
- issue-number : ${{ env.PR_NUMBER }}
76
- comment-author : ' github-actions[bot]'
77
- body-includes : ' ## 📚 Docs Preview'
78
- direction : last
79
-
80
- - name : Create or update preview comment
81
- if : steps.docs-preview.outputs.has_changes == 'true'
82
- uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
83
- env :
84
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
85
- with :
86
- comment-id : ${{ steps.find-comment.outputs.comment-id }}
87
- issue-number : ${{ env.PR_NUMBER }}
88
- body : |
89
- ## 📚 Docs Preview
90
-
91
- Your documentation changes are available for preview at:
92
- **🔗 [Documentation Preview](${{ steps.docs-preview.outputs.url }})**
93
-
94
- > Note: Branch names with slashes (e.g., `username/feature`) are converted to dashes (e.g., `username-feature`) in the preview URL.
95
-
96
- ### Changed Documentation Files
97
- ${{ steps.docs-preview.outputs.changed_files }}
98
-
99
- ${{ steps.docs-preview.outputs.has_new_docs == 'true' && '### Newly Added Documentation' || '' }}
100
- ${{ steps.docs-preview.outputs.has_new_docs == 'true' && steps.docs-preview.outputs.new_docs || '' }}
101
-
102
- ${{ steps.docs-preview.outputs.has_new_docs == 'true' && '### Preview Links for New Docs' || '' }}
103
- ${{ steps.docs-preview.outputs.has_new_docs == 'true' && steps.docs-preview.outputs.preview_links || '' }}
104
-
105
- ---
106
- <sub>🤖 This comment is automatically generated and updated when documentation changes.</sub>
107
- edit-mode : replace
108
- reactions : eyes
109
- reactions-edit-mode : replace
25
+ echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
26
+ echo "::notice::Extracted PR number: ${{ github.event.pull_request.number }}"
27
+
28
+ # Use the unified workflow to generate the preview and validation results
29
+ docs-preview :
30
+ name : Generate Docs Preview
31
+ needs : prepare
32
+ uses : ./.github/workflows/docs-unified.yaml
33
+ permissions :
34
+ contents : read
35
+ pull-requests : write
36
+ with :
37
+ # Focus on the preview and validation
38
+ lint-markdown : true
39
+ check-format : true
40
+ check-links : true
41
+ check-cross-references : true
42
+ lint-vale : true
43
+ generate-preview : true
44
+ post-comment : true
45
+ fail-on-error : false
46
+ pr-number : ${{ needs.prepare.outputs.pr_number }}
0 commit comments