Skip to content

Commit a565e48

Browse files
committed
CI/docs: update comments when the links in the docs are valid
1 parent 1746fc7 commit a565e48

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/scripts/verify-code-references.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,22 @@ echo ""
182182

183183
if [[ $EXIT_CODE -eq 0 ]]; then
184184
echo -e "${GREEN}✓ All code references are valid!${NC}"
185+
186+
# If in PR comment mode, write success message to file
187+
if [[ -n "${COMMENT_FILE}" ]]; then
188+
cat > "${COMMENT_FILE}" <<EOF
189+
## ✓ Code Reference Verification Passed
190+
191+
All code references in the documentation have been verified successfully!
192+
193+
**Total references checked:** ${TOTAL_REFS}
194+
**Valid references:** ${VALID_REFS}
195+
196+
The documentation is in sync with the codebase on the \`develop\` branch.
197+
EOF
198+
echo ""
199+
echo "PR success comment written to: ${COMMENT_FILE}"
200+
fi
185201
else
186202
echo -e "${RED}✗ Some code references are invalid. Please update the documentation.${NC}"
187203

.github/workflows/docs.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ jobs:
5757
run: |
5858
bash .github/scripts/verify-code-references.sh --pr-comment /tmp/pr-comment.md
5959
if [ -f /tmp/pr-comment.md ]; then
60-
echo "has_errors=true" >> $GITHUB_OUTPUT
60+
echo "has_comment=true" >> $GITHUB_OUTPUT
6161
echo "Comment file created, will post to PR"
6262
cat /tmp/pr-comment.md
6363
else
64-
echo "has_errors=false" >> $GITHUB_OUTPUT
65-
echo "No errors found, no comment needed"
64+
echo "has_comment=false" >> $GITHUB_OUTPUT
65+
echo "No comment file created"
6666
fi
6767
68-
- name: Comment PR on verification failure
69-
if: github.event_name == 'pull_request' && steps.verify-pr.outputs.has_errors == 'true'
68+
- name: Comment PR with verification results
69+
if: github.event_name == 'pull_request' && steps.verify-pr.outputs.has_comment == 'true'
7070
uses: thollander/actions-comment-pull-request@v3
7171
with:
7272
file-path: /tmp/pr-comment.md

0 commit comments

Comments
 (0)