Skip to content

Add documentation checks for every push and PR - #2

Merged
TehseenTech merged 5 commits into
mainfrom
agent/add-documentation-ci
Jul 20, 2026
Merged

Add documentation checks for every push and PR#2
TehseenTech merged 5 commits into
mainfrom
agent/add-documentation-ci

Conversation

@TehseenTech

Copy link
Copy Markdown
Owner

What changed

  • Added a GitHub Actions workflow triggered by every push and pull request
  • Added a dependency-free Python validator for required documentation, empty Markdown files, repository path traversal, and broken relative links
  • Added a pull-request safety and privacy checklist

Why

The repository had no GitHub Actions workflow, so merged documentation changes received no automated validation.

Validation

  • Workflow uses read-only repository permissions
  • Job has a five-minute timeout and concurrency cancellation
  • Validator relies only on Python's standard library
  • No case data or secrets are used

@warpfix warpfix Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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
Loading

⏱ 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

Comment thread .github/pull_request_template.md Outdated
@@ -0,0 +1,15 @@
## Summary

<!-- Explain the documentation change and why it is needed. -->

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 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."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Critical bug

The script does not handle the case where the required files are missing gracefully. Consider adding error handling.

Suggested change
def link_target(raw: str) -> str:
Add a try-except block around file reading operations.

🤖 WarpFix

Comment thread .github/scripts/check_docs.py Outdated
errors.append(f"missing required file: {relative}")

markdown_files = sorted(
path for path in ROOT.rglob("*.md") if ".git" not in path.parts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning performance

Using rglob may lead to performance issues if there are many files. Consider limiting the search scope if possible.

🤖 WarpFix

Comment thread .github/scripts/check_docs.py Outdated
if not target:
continue

resolved = (path.parent / target).resolve()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Critical bug

The script does not check for circular links which could lead to infinite loops.

Suggested change
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}"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning style

Consider logging the errors instead of printing them directly for better traceability.

Suggested change
)
Use the logging module to log errors.

🤖 WarpFix


on:
push:
pull_request:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 Nitpick style

Consider specifying a specific version for the checkout action to avoid unexpected changes.

Suggested change
runs-on: ubuntu-latest
Use a specific version like `actions/checkout@v2.3.4`.

🤖 WarpFix

@TehseenTech
TehseenTech marked this pull request as ready for review July 20, 2026 14:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/scripts/check_docs.py Outdated
Comment thread .github/scripts/check_docs.py
Comment thread .github/scripts/check_docs.py Outdated
Comment thread .github/scripts/check_docs.py

@warpfix warpfix Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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
Loading

⏱ 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." -->

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning logic

Consider adding a check to ensure that the 'REQUIRED' files are not empty or contain only comments.

Suggested change
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Critical logic

The link validation does not account for external links, which could lead to false positives.

Suggested change
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning documentation

The error message for broken links could be more informative by suggesting possible fixes.

Suggested change
continue
Include a suggestion to check the target path and filename in the error message.

🤖 WarpFix

permissions:
contents: read

concurrency:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise style

Using the latest version of the checkout action ensures that you benefit from the latest features and fixes.

🤖 WarpFix

@warpfix warpfix Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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
Loading

⏱ 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." -->

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 Nitpick documentation

Consider adding a brief explanation for each checklist item for clarity.

🤖 WarpFix


ROOT = Path(__file__).resolve().parents[2]
REQUIRED = (
Path("README.md"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 Nitpick style

Consider using a constant for the encoding type to avoid magic strings.

Suggested change
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] = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Critical error handling

The script does not handle cases where the Markdown file cannot be read due to permission issues.

Suggested change
Consider adding a specific error message for permission errors.

🤖 WarpFix

if target.startswith("/"):
resolved = (ROOT / target.lstrip("/")).resolve()
else:
resolved = (path.parent / target).resolve()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning performance

The link validation logic could be optimized to avoid multiple calls to resolve paths.

Suggested change
resolved = (path.parent / target).resolve()
Cache resolved paths to improve performance.

🤖 WarpFix

"(check the target path and filename)"
)

if errors:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

Suggested change
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 }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise documentation

Well-structured workflow configuration for documentation checks.

🤖 WarpFix

name: Validate documentation
runs-on: ubuntu-latest
timeout-minutes: 5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 Nitpick style

Consider specifying a specific version for the checkout action to avoid unexpected changes.

Suggested change
uses: actions/checkout@v4.0.0

🤖 WarpFix

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread .github/scripts/check_docs.py Outdated
Comment thread .github/scripts/check_docs.py Outdated
Comment thread .github/scripts/check_docs.py Outdated
@TehseenTech
TehseenTech merged commit 55214be into main Jul 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant