Skip to content

Commit 7ffdce5

Browse files
authored
Add workflow dispatch to documentation-review.yml
1 parent 30141ff commit 7ffdce5

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

.github/workflows/documentation-review.yml

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ on:
66
paths:
77
- 'docusaurus/docs/**/*.md'
88
- '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
920

1021
jobs:
1122
validate-documentation:
@@ -30,7 +41,13 @@ jobs:
3041
id: validation
3142
run: |
3243
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
3451
continue-on-error: true
3552

3653
- name: Comment PR with results
@@ -126,13 +143,33 @@ jobs:
126143
comment += '---\n';
127144
comment += '*🤖 Automated review based on [Strapi\'s 12 Rules of Technical Writing](https://strapi.notion.site/12-Rules-of-Technical-Writing)*\n';
128145
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+
129151
// 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+
}
136173
137174
// Set step output for potential failure
138175
if (results.issues.errors.length > 0) {

0 commit comments

Comments
 (0)