Skip to content

Commit e30a821

Browse files
feat: adding docs change validation step in reuseable CI (#390)
### Description Added a new job validate-docs-change. This job will attempt to serve the documentation and fail if there are any errors. If errors occur, they will be printed in the check logs step. Another stage, enforce-docs-changes, reviews the result of validate-docs-change and uses run metadata to determine whether the job should fail the pipeline. When the PR targets the main branch, enforce-docs-changes will enforce failure on broken documentation and block merge. For other branches, it serves as an indicator of documentation issues without blocking the merge. ### Checklist - [ ] `README.md` has been updated or is not required - [ ] push trigger tests - [ ] manual release test - [ ] automated releases test - [ ] pull request trigger tests - [ ] schedule trigger tests - [ ] workflow errors/warnings reviewed and addressed ### Testing done (for each selected checkbox, the corresponding test results link should be listed here)
1 parent 8adf4a0 commit e30a821

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/reusable-build-test-release.yml

+44
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,44 @@ jobs:
321321
splunk_version_list=$(echo '${{ steps.determine_splunk.outputs.matrixSplunk }}' | jq -r '.[].version')
322322
sc4s_version_list=$(echo '${{ steps.matrix.outputs.supportedSC4S }}' | jq -r '.[].version')
323323
echo -e "## Summary of Versions Used\n- **Splunk versions used:** (${splunk_version_list})\n- **SC4S versions used:** (${sc4s_version_list})\n- Browser: Chrome" >> "$GITHUB_STEP_SUMMARY"
324+
325+
validate-docs-change:
326+
runs-on: ubuntu-latest
327+
container:
328+
image: python:3.9
329+
outputs:
330+
status: ${{ steps.validate.outputs.status }}
331+
steps:
332+
- uses: actions/checkout@v4
333+
with:
334+
submodules: false
335+
persist-credentials: false
336+
- name: Installing requirements
337+
run: |
338+
pip install pip -U
339+
pip install mkdocs==1.6.1 mkdocs-material==9.6.9 poetry
340+
- name: validate
341+
id: validate
342+
run: |
343+
if poetry run mkdocs build --strict; then
344+
echo "status=success" >> "$GITHUB_OUTPUT"
345+
echo "status :: success"
346+
else
347+
echo "status=failure" >> "$GITHUB_OUTPUT"
348+
echo "status :: failure"
349+
fi
350+
351+
enforce-docs-checks:
352+
runs-on: ubuntu-latest
353+
needs: validate-docs-change
354+
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
355+
steps:
356+
- name: Fail if validate-docs-change failed
357+
run: |
358+
if [ "${{ needs.validate-docs-change.outputs.status }}" == "failure" ]; then
359+
exit 1
360+
fi
361+
324362
fossa-scan:
325363
runs-on: ubuntu-latest
326364
steps:
@@ -2956,6 +2994,7 @@ jobs:
29562994
- run-ucc-modinput-tests
29572995
- run-ui-tests
29582996
- validate-pr-title
2997+
- enforce-docs-checks
29592998
runs-on: ubuntu-latest
29602999
env:
29613000
NEEDS: ${{ toJson(needs) }}
@@ -2973,6 +3012,11 @@ jobs:
29733012
echo "run-publish=false" >> "$GITHUB_OUTPUT"
29743013
echo "Publish conditions are not met."
29753014
fi
3015+
if ${{ github.base_ref == 'main' }} && ${{ needs.enforce-docs-checks.result != 'success' }};
3016+
then
3017+
echo " There are documentation changes that break mkdocs deploy. please check validate-docs-change step."
3018+
exit 1
3019+
fi
29763020
29773021
publish:
29783022
if: ${{ !cancelled() && needs.pre-publish.outputs.run-publish == 'true' && (github.event_name == 'push' || needs.validate-custom-version.result == 'success') }}

0 commit comments

Comments
 (0)