Files
Northern-Thailand-Ping-Rive…/scripts/generate_badges.py
grabowski 19e182c53b
Some checks failed
Release - Northern Thailand Ping River Monitor / Create Release (push) Successful in 6s
Security & Dependency Updates / Dependency Security Scan (push) Successful in 19s
Security & Dependency Updates / Docker Security Scan (push) Successful in 1m12s
Security & Dependency Updates / License Compliance (push) Successful in 11s
Security & Dependency Updates / Check for Dependency Updates (push) Successful in 14s
Security & Dependency Updates / Code Quality Metrics (push) Successful in 9s
Release - Northern Thailand Ping River Monitor / Test Release Build (3.10) (push) Failing after 1m17s
Release - Northern Thailand Ping River Monitor / Test Release Build (3.11) (push) Failing after 23s
Release - Northern Thailand Ping River Monitor / Test Release Build (3.9) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Build Release Images (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Security Scan (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Deploy Release (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Validate Release (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Notify Release (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.12) (push) Has been cancelled
Security & Dependency Updates / Security Summary (push) Has been cancelled
Version bump: 3.1.0 3.1.1
Version Updates:
- Core application version (src/__init__.py)
- Web API version (src/web_api.py)
- Main application logging (src/main.py)
- Package setup version (setup.py)
- Documentation generation (docs workflow)
- Release workflow example version
- Badge generation script
- Integration test version display
- README.md badge version
- Setup and deployment documentation
- Git initialization scripts

 Patch Release (3.1.1):
- Workflow token migration fixes (GITHUB_TOKEN  GH_TOKEN)
- Pip installation warning elimination
- Improved workflow reliability and logging
- Better Gitea compatibility
- Enhanced error handling and validation

 Files Updated:
- 13 files with version references updated
- Consistent versioning across all components
- Ready for release tagging and deployment
2025-08-12 16:52:39 +07:00

51 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""
Generate status badges for README.md
"""
import json
import requests
from datetime import datetime
def generate_badge_url(label, message, color="brightgreen"):
"""Generate a shields.io badge URL"""
return f"https://img.shields.io/badge/{label}-{message}-{color}"
def generate_workflow_badge(repo_url, workflow_name, branch="main"):
"""Generate workflow status badge"""
# For Gitea, you might need to adjust this based on your instance
badge_url = f"{repo_url}/actions/workflows/{workflow_name}/badge.svg?branch={branch}"
return badge_url
def main():
"""Generate badges for the project"""
repo_url = "https://git.b4l.co.th/B4L/Northern-Thailand-Ping-River-Monitor"
badges = {
"CI/CD": generate_workflow_badge(repo_url, "ci.yml"),
"Security": generate_workflow_badge(repo_url, "security.yml"),
"Documentation": generate_workflow_badge(repo_url, "docs.yml"),
"Python": generate_badge_url("Python", "3.9%2B", "blue"),
"FastAPI": generate_badge_url("FastAPI", "0.104%2B", "green"),
"Docker": generate_badge_url("Docker", "Ready", "blue"),
"License": generate_badge_url("License", "MIT", "green"),
"Version": generate_badge_url("Version", "v3.1.1", "blue"),
}
print("# Status Badges")
print()
print("Add these badges to your README.md:")
print()
for name, url in badges.items():
print(f"[![{name}]({url})]({repo_url})")
print()
print("# Markdown Format")
print()
badge_line = " ".join([f"[![{name}]({url})]({repo_url})" for name, url in badges.items()])
print(badge_line)
if __name__ == "__main__":
main()