Add documentation checks for every push and PR - #2
Conversation
There was a problem hiding this comment.
🔍 WarpFix PR Review
This pull request introduces a GitHub Actions workflow to automate documentation checks for every push and pull request. It includes a Python script that validates required documentation files, checks for empty Markdown files, and verifies the integrity of relative links.
📖 Walkthrough
The changes consist of three main files: a pull request template that outlines a safety and privacy checklist, a Python script that performs various documentation validations, and a GitHub Actions workflow that triggers the validation process on pushes and pull requests. The pull request template encourages contributors to ensure that sensitive information is not included in documentation. The Python script checks for the existence of required Markdown files, identifies empty files, and verifies that all relative links are valid. The workflow is designed to run on every push and pull request, ensuring that documentation quality is maintained automatically.
📁 File Changes
| File | Change | Impact |
|---|---|---|
.github/pull_request_template.md |
Added a template for pull requests with a safety and privacy checklist. | 🟡 medium |
.github/scripts/check_docs.py |
Introduced a Python script to validate documentation files and links. | 🔴 high |
.github/workflows/documentation-checks.yml |
Created a GitHub Actions workflow to automate documentation checks. | 🔴 high |
📊 Sequence Diagram
sequenceDiagram
participant User
participant GitHub
participant CI
User->>GitHub: Push or create PR
GitHub->>CI: Trigger documentation checks
CI->>CI: Run check_docs.py
CI-->>GitHub: Report results
⏱ Review Effort & Risk
| Metric | Value |
|---|---|
| Effort | ███░░ 3/5 (Moderate) · ~30min |
| Risk | 🟡 MEDIUM |
Risk Factors
- New automated checks may fail if documentation structure changes.
- Potential for false negatives if links are incorrectly formatted.
Labels: documentation automation CI
💡 Key Observations
The implementation relies solely on Python's standard library, which enhances portability.
The workflow uses read-only permissions, minimizing security risks.
🤖 Reviewed by WarpFix — AI-Powered Code Review + CI Repair · Security
| @@ -0,0 +1,15 @@ | |||
| ## Summary | |||
|
|
|||
| <!-- Explain the documentation change and why it is needed. --> | |||
There was a problem hiding this comment.
💅 Nitpick documentation
Consider providing an example of a documentation change in the summary section.
🤖 WarpFix
| - [ ] No victim, client, or active-case data is included | ||
| - [ ] No credentials, financial records, identity numbers, or private media are included | ||
| - [ ] New factual claims cite an authoritative source | ||
| - [ ] Official links were checked |
There was a problem hiding this comment.
✨ Praise documentation
Great inclusion of a safety and privacy checklist to ensure sensitive data is not included.
🤖 WarpFix
| - [ ] Guidance is defensive and does not promise recovery or legal outcomes | ||
|
|
||
| ## Validation | ||
|
|
There was a problem hiding this comment.
💅 Nitpick documentation
Consider adding a checklist item for ensuring that all links in the documentation are functional.
🤖 WarpFix
| @@ -0,0 +1,88 @@ | |||
| """Validate required documentation and local Markdown links.""" | |||
There was a problem hiding this comment.
✨ Praise documentation
Good use of docstrings to explain the purpose of the script.
🤖 WarpFix
| LINK_PATTERN = re.compile(r"!?[[^]]*](([^)]+))") | ||
|
|
||
|
|
||
| def link_target(raw: str) -> str: |
There was a problem hiding this comment.
🚨 Critical bug
The script does not handle the case where the required files are missing gracefully. Consider adding error handling.
| def link_target(raw: str) -> str: | |
| Add a try-except block around file reading operations. |
🤖 WarpFix
| errors.append(f"missing required file: {relative}") | ||
|
|
||
| markdown_files = sorted( | ||
| path for path in ROOT.rglob("*.md") if ".git" not in path.parts |
There was a problem hiding this comment.
performance
Using rglob may lead to performance issues if there are many files. Consider limiting the search scope if possible.
🤖 WarpFix
| if not target: | ||
| continue | ||
|
|
||
| resolved = (path.parent / target).resolve() |
There was a problem hiding this comment.
🚨 Critical bug
The script does not check for circular links which could lead to infinite loops.
| resolved = (path.parent / target).resolve() | |
| Implement a set to track visited links and prevent circular references. |
🤖 WarpFix
| if not resolved.exists(): | ||
| errors.append( | ||
| f"{relative}:{line_number}: broken relative link: {raw}" | ||
| ) |
There was a problem hiding this comment.
style
Consider logging the errors instead of printing them directly for better traceability.
| ) | |
| Use the logging module to log errors. |
🤖 WarpFix
|
|
||
| on: | ||
| push: | ||
| pull_request: |
There was a problem hiding this comment.
✨ Praise documentation
Well-defined triggers for the workflow to ensure documentation checks on relevant events.
🤖 WarpFix
| jobs: | ||
| validate: | ||
| name: Validate documentation | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
💅 Nitpick style
Consider specifying a specific version for the checkout action to avoid unexpected changes.
| runs-on: ubuntu-latest | |
| Use a specific version like `actions/checkout@v2.3.4`. |
🤖 WarpFix
There was a problem hiding this comment.
Code Review
This pull request introduces a pull request template and a Python script (check_docs.py) to validate required documentation files and local Markdown links. The review feedback highlights several critical and high-severity issues in the script: the regular expression for matching Markdown links is broken, a listed required file (docs/seo-metadata.md) is missing from the repository, the repository root resolution is fragile if run from other directories, and the script should exclude common directories like .venv or node_modules when scanning for Markdown files to prevent false positives and performance issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
🔍 WarpFix PR Review
This pull request introduces a GitHub Actions workflow for automated documentation checks on every push and pull request. It includes a Python script that validates required documentation files, checks for empty Markdown files, and verifies the integrity of relative links.
📖 Walkthrough
The PR adds three files: a pull request template that includes a safety and privacy checklist, a Python script that performs various validation checks on documentation files, and a GitHub Actions workflow configuration that triggers these checks on every push and pull request. The pull request template ensures that contributors consider privacy and safety before submitting changes. The Python script checks for the existence of required documentation files, ensures Markdown files are not empty, and validates that all relative links are correct and do not escape the repository structure. The workflow is configured to run with read-only permissions and has a timeout to prevent long-running jobs.
📁 File Changes
| File | Change | Impact |
|---|---|---|
.github/pull_request_template.md |
Added a template for pull requests with a checklist for safety and privacy. | 🟡 medium |
.github/scripts/check_docs.py |
Introduced a Python script to validate documentation files and links. | 🔴 high |
.github/workflows/documentation-checks.yml |
Created a GitHub Actions workflow to automate documentation checks. | 🔴 high |
📊 Sequence Diagram
sequenceDiagram
participant User
participant GitHub
participant CI
User->>GitHub: Push or PR
GitHub->>CI: Trigger workflow
CI->>CI: Run check_docs.py
CI-->>GitHub: Report results
⏱ Review Effort & Risk
| Metric | Value |
|---|---|
| Effort | ███░░ 3/5 (Moderate) · ~30min |
| Risk | 🟡 MEDIUM |
Risk Factors
- Potential for false negatives in link validation
- Dependency on the correctness of the Python script
- Impact on workflow execution time if many Markdown files are present
Labels: documentation CI enhancement
💡 Key Observations
The validation script relies solely on Python's standard library, which is a positive aspect for portability.
The pull request template encourages contributors to consider safety and privacy, which is crucial for maintaining data integrity.
🤖 Reviewed by WarpFix — AI-Powered Code Review + CI Repair · Security
| @@ -0,0 +1,18 @@ | |||
| ## Summary | |||
|
|
|||
| <!-- Explain the documentation change and why it is needed. Example: "Update the NCCIA complaint link and clarify the reporting steps." --> | |||
There was a problem hiding this comment.
✨ Praise documentation
Great addition of a summary section to clarify the purpose of the documentation changes.
🤖 WarpFix
| <!-- Check every applicable item before requesting review. --> | ||
|
|
||
| - [ ] No victim, client, or active-case data is included | ||
| - [ ] No credentials, financial records, identity numbers, or private media are included |
There was a problem hiding this comment.
✨ Praise documentation
The safety and privacy checklist is a valuable addition to ensure compliance and protect sensitive information.
🤖 WarpFix
| - [ ] All added or changed documentation links work | ||
| - [ ] Guidance is defensive and does not promise recovery or legal outcomes | ||
|
|
||
| ## Validation |
There was a problem hiding this comment.
✨ Praise documentation
Including a validation section is excellent for ensuring that documentation checks are performed.
🤖 WarpFix
| import re | ||
| import sys | ||
| from pathlib import Path | ||
| from urllib.parse import unquote |
There was a problem hiding this comment.
✨ Praise style
Using pathlib for file handling improves readability and cross-platform compatibility.
🤖 WarpFix
| else: | ||
| value = value.split(maxsplit=1)[0] | ||
| return unquote(value.split("#", 1)[0].split("?", 1)[0]) | ||
|
|
There was a problem hiding this comment.
logic
Consider adding a check to ensure that the 'REQUIRED' files are not empty or contain only comments.
| Add a check after loading the files to validate their content. |
🤖 WarpFix
| f"{relative}:{line_number}: empty relative link target " | ||
| "(add a path or remove the link)" | ||
| ) | ||
| continue |
There was a problem hiding this comment.
🚨 Critical logic
The link validation does not account for external links, which could lead to false positives.
| continue | |
| Add a condition to skip validation for links that start with http or https. |
🤖 WarpFix
| f"{relative}:{line_number}: link escapes repository: " | ||
| f"{raw} (use a path inside the repository)" | ||
| ) | ||
| continue |
There was a problem hiding this comment.
documentation
The error message for broken links could be more informative by suggesting possible fixes.
| continue | |
| Include a suggestion to check the target path and filename in the error message. |
🤖 WarpFix
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: |
There was a problem hiding this comment.
✨ Praise performance
The use of concurrency settings is a good practice to optimize workflow execution.
🤖 WarpFix
| name: Validate documentation | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
|
|
There was a problem hiding this comment.
✨ Praise performance
Specifying a timeout for the job is a good way to prevent hanging processes.
🤖 WarpFix
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@v4 | ||
|
|
There was a problem hiding this comment.
✨ Praise style
Using the latest version of the checkout action ensures that you benefit from the latest features and fixes.
🤖 WarpFix
There was a problem hiding this comment.
🔍 WarpFix PR Review
This pull request introduces a GitHub Actions workflow for validating documentation on every push and pull request. It includes a Python script that checks for required documentation files, validates Markdown links, and ensures compliance with a safety and privacy checklist.
📖 Walkthrough
The changes consist of three main files: a pull request template that outlines a summary and a safety checklist, a Python script that validates the presence of required documentation files and checks for broken links in Markdown files, and a GitHub Actions workflow that triggers the validation process on every push and pull request. The workflow is designed to run with read-only permissions and includes concurrency management to prevent overlapping runs.
📁 File Changes
| File | Change | Impact |
|---|---|---|
.github/pull_request_template.md |
Added a template for pull requests that includes a summary section and a safety checklist. | 🟡 medium |
.github/scripts/check_docs.py |
Introduced a Python script to validate required documentation files and check for broken Markdown links. | 🔴 high |
.github/workflows/documentation-checks.yml |
Created a GitHub Actions workflow to automate the documentation validation process. | 🔴 high |
📊 Sequence Diagram
sequenceDiagram
participant User as User
participant GitHub as GitHub Actions
participant Validator as Documentation Validator
User->>GitHub: Push or PR
GitHub->>Validator: Trigger validation workflow
Validator->>Validator: Check required files
Validator->>Validator: Validate Markdown links
Validator-->>GitHub: Return validation results
GitHub-->>User: Notify validation status
⏱ Review Effort & Risk
| Metric | Value |
|---|---|
| Effort | ███░░ 3/5 (Moderate) · ~30min |
| Risk | 🟡 MEDIUM |
Risk Factors
- Potential for false negatives in link validation
- Dependence on the correct structure of Markdown files
- New workflow may introduce CI/CD pipeline complexity
Labels: documentation CI/CD enhancement
💡 Key Observations
The pull request template encourages thorough documentation practices.
The Python script is dependency-free, which enhances portability.
The workflow includes concurrency management to avoid conflicts.
🤖 Reviewed by WarpFix — AI-Powered Code Review + CI Repair · Security
| @@ -0,0 +1,18 @@ | |||
| ## Summary | |||
|
|
|||
| <!-- Explain the documentation change and why it is needed. Example: "Update the NCCIA complaint link and clarify the reporting steps." --> | |||
There was a problem hiding this comment.
💅 Nitpick documentation
Consider providing a more specific example in the summary section to guide contributors.
🤖 WarpFix
| <!-- Check every applicable item before requesting review. --> | ||
|
|
||
| - [ ] No victim, client, or active-case data is included | ||
| - [ ] No credentials, financial records, identity numbers, or private media are included |
There was a problem hiding this comment.
✨ Praise documentation
Great addition of a safety and privacy checklist to ensure compliance.
🤖 WarpFix
| - [ ] Official links were checked | ||
| - [ ] All added or changed documentation links work | ||
| - [ ] Guidance is defensive and does not promise recovery or legal outcomes | ||
|
|
There was a problem hiding this comment.
💅 Nitpick documentation
Consider adding a brief explanation for each checklist item for clarity.
🤖 WarpFix
|
|
||
| ROOT = Path(__file__).resolve().parents[2] | ||
| REQUIRED = ( | ||
| Path("README.md"), |
There was a problem hiding this comment.
💅 Nitpick style
Consider using a constant for the encoding type to avoid magic strings.
| Path("README.md"), | |
| ENCODING = 'utf-8' | |
| text = path.read_text(encoding=ENCODING) |
🤖 WarpFix
| def main() -> int: | ||
| """Validate required files and repository-local Markdown links.""" | ||
| errors: list[str] = [] | ||
|
|
There was a problem hiding this comment.
logic
Ensure that the 'REQUIRED' files are always present in the repository to avoid runtime errors.
🤖 WarpFix
| except (OSError, UnicodeError) as exc: | ||
| errors.append(f"unable to read {relative}: {exc}") | ||
| continue | ||
|
|
There was a problem hiding this comment.
🚨 Critical error handling
The script does not handle cases where the Markdown file cannot be read due to permission issues.
| Consider adding a specific error message for permission errors. |
🤖 WarpFix
| if target.startswith("/"): | ||
| resolved = (ROOT / target.lstrip("/")).resolve() | ||
| else: | ||
| resolved = (path.parent / target).resolve() |
There was a problem hiding this comment.
performance
The link validation logic could be optimized to avoid multiple calls to resolve paths.
| resolved = (path.parent / target).resolve() | |
| Cache resolved paths to improve performance. |
🤖 WarpFix
| "(check the target path and filename)" | ||
| ) | ||
|
|
||
| if errors: |
There was a problem hiding this comment.
🚨 Critical logic
The script does not exit with a non-zero status code if no Markdown files are found, which may lead to false positives in CI.
| if errors: | |
| Return 1 if errors are found, including the case of no Markdown files. |
🤖 WarpFix
| contents: read | ||
|
|
||
| concurrency: | ||
| group: docs-${{ github.workflow }}-${{ github.ref }} |
There was a problem hiding this comment.
✨ Praise documentation
Well-structured workflow configuration for documentation checks.
🤖 WarpFix
| name: Validate documentation | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
|
|
There was a problem hiding this comment.
💅 Nitpick style
Consider specifying a specific version for the checkout action to avoid unexpected changes.
| uses: actions/checkout@v4.0.0 |
🤖 WarpFix
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27e38a9d0b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What changed
Why
The repository had no GitHub Actions workflow, so merged documentation changes received no automated validation.
Validation