mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-17 21:54:05 +02:00
Completed maintenance script and action workflow
This commit is contained in:
39
.github/workflows/format-maintenance.yml
vendored
Normal file
39
.github/workflows/format-maintenance.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
name: Format Maintenance
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'source/data/**'
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
persist-credentials: true
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt || true
|
||||
|
||||
- name: Run script to check for format errors
|
||||
run: python ./source/scripts/maintenance/json_formatter.py
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add readmes/format_maintenence.md
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "Format Maintenance"
|
||||
git push
|
||||
39
.github/workflows/status-maintenance.yml
vendored
Normal file
39
.github/workflows/status-maintenance.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
name: Status Maintenance
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * 1' # every Monday at 2:00 AM UTC
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
persist-credentials: true
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt || true
|
||||
|
||||
- name: Run script to check for project status
|
||||
run: python ./source/scripts/maintenance/status_checker.py
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add readmes/status_maintenence.md
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "Status Check"
|
||||
git push
|
||||
@@ -0,0 +1,59 @@
|
||||
import json
|
||||
|
||||
with open("source/data/dynamic/applications.json") as f:
|
||||
applications = json.load(f)["applications"]
|
||||
|
||||
with open("source/data/static/categories.json") as f:
|
||||
categories_data = json.load(f)["subcategories"]
|
||||
valid_categories = {c["id"].lower() for c in categories_data}
|
||||
|
||||
with open("source/data/static/platforms.json") as f:
|
||||
platforms_data = json.load(f)["platforms"]
|
||||
valid_platforms = {p["id"].lower() for p in platforms_data}
|
||||
|
||||
seen_github = set()
|
||||
issues_report = []
|
||||
|
||||
for app in applications:
|
||||
app_issues = []
|
||||
|
||||
github_url = app.get("repo_url", "").strip()
|
||||
if not github_url:
|
||||
app_issues.append("Missing GitHub URL")
|
||||
elif github_url in seen_github:
|
||||
app_issues.append("Duplicate GitHub URL")
|
||||
else:
|
||||
seen_github.add(github_url)
|
||||
|
||||
category = app.get("category", "").lower()
|
||||
if not category:
|
||||
app_issues.append("Missing category")
|
||||
elif category not in valid_categories:
|
||||
app_issues.append(f"Invalid category '{category}'")
|
||||
|
||||
platforms = [p.lower() for p in app.get("platforms", [])]
|
||||
if not platforms:
|
||||
app_issues.append("Missing platform")
|
||||
else:
|
||||
invalid_platforms = [p for p in platforms if p not in valid_platforms]
|
||||
if invalid_platforms:
|
||||
app_issues.append(f"Invalid platforms: {', '.join(invalid_platforms)}")
|
||||
|
||||
if app_issues:
|
||||
issues_report.append({
|
||||
"name": app.get("name", "Unnamed Project"),
|
||||
"issues": app_issues
|
||||
})
|
||||
|
||||
with open("readmes/format_maintenance.md", "w") as f:
|
||||
f.write("# Format Maintenance Report\n\n")
|
||||
if not issues_report:
|
||||
f.write("No issues found. All applications are properly formatted.\n")
|
||||
else:
|
||||
for entry in issues_report:
|
||||
f.write(f"## {entry['name']}\n")
|
||||
for issue in entry["issues"]:
|
||||
f.write(f"- {issue}\n")
|
||||
f.write("\n")
|
||||
|
||||
print("Maintenance report generated: format_maintenance.md")
|
||||
|
||||
Reference in New Issue
Block a user