@@ -2,6 +2,7 @@ name: Validate Documentation
22
33on :
44 pull_request :
5+ types : [opened, synchronize, reopened] # Run on PR open AND every commit
56 branches :
67 - main
78 paths :
@@ -43,15 +44,24 @@ jobs:
4344 echo "::endgroup::"
4445 continue-on-error : true
4546
46- - name : Post PR comment
47- if : steps.check-links.outputs.issues_found == 'true' || steps.check-images.outputs.issues_found == 'true'
47+ - name : Post or update PR comment
48+ if : always() # Always run to update comment even if issues are fixed
4849 uses : actions/github-script@v7
4950 with :
5051 script : |
5152 const fs = require('fs');
5253
54+ // Build comment body
5355 let comment = '## 📋 Documentation Validation Report\n\n';
54- comment += '⚠️ Some issues were found in this PR. These are **informational warnings** and will not block merging.\n\n';
56+
57+ const hasIssues = '${{ steps.check-links.outputs.issues_found }}' === 'true' ||
58+ '${{ steps.check-images.outputs.issues_found }}' === 'true';
59+
60+ if (hasIssues) {
61+ comment += '⚠️ Some issues were found in this PR. These are **informational warnings** and will not block merging.\n\n';
62+ } else {
63+ comment += '✅ All validation checks passed!\n\n';
64+ }
5565
5666 if ('${{ steps.check-links.outputs.issues_found }}' === 'true') {
5767 const linksOutput = fs.readFileSync('/tmp/check-links-output.txt', 'utf8');
@@ -90,13 +100,34 @@ jobs:
90100 comment += '- All internal links must point to existing files\n\n';
91101 comment += '📖 Run `node scripts/check-links.js` and `node scripts/check-image-locations.js` locally for full details.\n';
92102
93- github.rest.issues.createComment({
103+ // Find existing comment from this bot
104+ const { data: comments } = await github.rest.issues.listComments({
94105 issue_number: context.issue.number,
95106 owner: context.repo.owner,
96107 repo: context.repo.repo,
97- body: comment
98108 });
99109
110+ const botComment = comments.find(c =>
111+ c.user.type === 'Bot' && c.body.includes('📋 Documentation Validation Report')
112+ );
113+
114+ // Update existing or create new
115+ if (botComment) {
116+ await github.rest.issues.updateComment({
117+ comment_id: botComment.id,
118+ owner: context.repo.owner,
119+ repo: context.repo.repo,
120+ body: comment
121+ });
122+ } else {
123+ await github.rest.issues.createComment({
124+ issue_number: context.issue.number,
125+ owner: context.repo.owner,
126+ repo: context.repo.repo,
127+ body: comment
128+ });
129+ }
130+
100131 - name : Report results
101132 if : always()
102133 run : |
0 commit comments