|
6 | 6 | paths: |
7 | 7 | - 'docusaurus/docs/**/*.md' |
8 | 8 | - 'docusaurus/docs/**/*.mdx' |
| 9 | + |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + pr_number: |
| 13 | + description: 'PR number to validate (leave empty for current branch)' |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + target_files: |
| 17 | + description: 'Specific files to validate (optional)' |
| 18 | + required: false |
| 19 | + type: string |
9 | 20 |
|
10 | 21 | jobs: |
11 | 22 | validate-documentation: |
|
30 | 41 | id: validation |
31 | 42 | run: | |
32 | 43 | cd docusaurus |
33 | | - node scripts/style-validation/validate-content-style.js --verbose |
| 44 | + if [ -n "${{ github.event.inputs.target_files }}" ]; then |
| 45 | + echo "Validating specific files: ${{ github.event.inputs.target_files }}" |
| 46 | + node scripts/style-validation/validate-content-style.js --verbose ${{ github.event.inputs.target_files }} |
| 47 | + else |
| 48 | + echo "Validating all documentation files" |
| 49 | + node scripts/style-validation/validate-content-style.js --verbose |
| 50 | + fi |
34 | 51 | continue-on-error: true |
35 | 52 |
|
36 | 53 | - name: Comment PR with results |
@@ -126,13 +143,33 @@ jobs: |
126 | 143 | comment += '---\n'; |
127 | 144 | comment += '*🤖 Automated review based on [Strapi\'s 12 Rules of Technical Writing](https://strapi.notion.site/12-Rules-of-Technical-Writing)*\n'; |
128 | 145 | |
| 146 | + // Add trigger info for manual runs |
| 147 | + if (context.eventName === 'workflow_dispatch') { |
| 148 | + comment += `*🔧 Manually triggered${github.event.inputs.pr_number ? ` for PR #${github.event.inputs.pr_number}` : ''}*\n\n`; |
| 149 | + } |
| 150 | + |
129 | 151 | // Post comment |
130 | | - await github.rest.issues.createComment({ |
131 | | - issue_number: context.issue.number, |
132 | | - owner: context.repo.owner, |
133 | | - repo: context.repo.repo, |
134 | | - body: comment |
135 | | - }); |
| 152 | + if (context.eventName === 'pull_request') { |
| 153 | + // Normal PR comment |
| 154 | + await github.rest.issues.createComment({ |
| 155 | + issue_number: context.issue.number, |
| 156 | + owner: context.repo.owner, |
| 157 | + repo: context.repo.repo, |
| 158 | + body: comment |
| 159 | + }); |
| 160 | + } else if (github.event.inputs.pr_number) { |
| 161 | + // Manual run with PR number |
| 162 | + await github.rest.issues.createComment({ |
| 163 | + issue_number: parseInt(github.event.inputs.pr_number), |
| 164 | + owner: context.repo.owner, |
| 165 | + repo: context.repo.repo, |
| 166 | + body: comment |
| 167 | + }); |
| 168 | + } else { |
| 169 | + // Manual run without PR - just log |
| 170 | + console.log('Manual validation completed'); |
| 171 | + console.log(comment); |
| 172 | + } |
136 | 173 | |
137 | 174 | // Set step output for potential failure |
138 | 175 | if (results.issues.errors.length > 0) { |
|
0 commit comments