docs: align weather README with redesigned interface #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Repository Quality | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate: | |
| name: Validate code and documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Validate Python syntax | |
| run: | | |
| python -m compileall -q \ | |
| Aplicacoes-Web \ | |
| IA-e-Automacao \ | |
| Machine-Learning \ | |
| Games | |
| - name: Validate internal README links and images | |
| shell: python | |
| run: | | |
| import re | |
| import sys | |
| from pathlib import Path | |
| from urllib.parse import unquote | |
| repository = Path.cwd() | |
| failures = [] | |
| markdown_link = re.compile(r"\[[^\]]*\]\(([^)]+)\)") | |
| html_source = re.compile(r"(?:src|href)=\"([^\"]+)\"") | |
| for readme in repository.rglob("README.md"): | |
| content = readme.read_text(encoding="utf-8") | |
| references = markdown_link.findall(content) + html_source.findall(content) | |
| for reference in references: | |
| clean_reference = unquote(reference.split("#", 1)[0].strip()) | |
| if not clean_reference or clean_reference.startswith(("http://", "https://", "mailto:", "#")): | |
| continue | |
| target = (readme.parent / clean_reference).resolve() | |
| try: | |
| target.relative_to(repository.resolve()) | |
| except ValueError: | |
| failures.append(f"{readme}: link outside repository -> {reference}") | |
| continue | |
| if not target.exists(): | |
| failures.append(f"{readme}: missing target -> {reference}") | |
| if failures: | |
| print("Internal documentation errors:") | |
| print("\n".join(f"- {failure}" for failure in failures)) | |
| sys.exit(1) | |
| print("All internal README links and images are valid.") | |
| - name: Check for common credential patterns | |
| shell: python | |
| run: | | |
| import re | |
| import sys | |
| from pathlib import Path | |
| patterns = { | |
| "OpenAI-style key": re.compile(r"\bsk-[A-Za-z0-9_-]{20,}\b"), | |
| "Groq-style key": re.compile(r"\bgsk_[A-Za-z0-9_-]{20,}\b"), | |
| "Google API key": re.compile(r"\bAIza[0-9A-Za-z_-]{30,}\b"), | |
| } | |
| ignored_suffixes = {".png", ".jpg", ".jpeg", ".gif", ".svg", ".csv"} | |
| findings = [] | |
| for path in Path.cwd().rglob("*"): | |
| if not path.is_file() or ".git" in path.parts or path.suffix.lower() in ignored_suffixes: | |
| continue | |
| try: | |
| content = path.read_text(encoding="utf-8") | |
| except UnicodeDecodeError: | |
| continue | |
| for label, pattern in patterns.items(): | |
| if pattern.search(content): | |
| findings.append(f"{label}: {path}") | |
| if findings: | |
| print("Possible credentials found:") | |
| print("\n".join(f"- {finding}" for finding in findings)) | |
| sys.exit(1) | |
| print("No common credential patterns found.") |