mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-17 21:54:05 +02:00
Updated directories to reflect working directories
This commit is contained in:
26
.github/workflows/generate-readme.yml
vendored
26
.github/workflows/generate-readme.yml
vendored
@@ -1,22 +1,20 @@
|
||||
|
||||
name: Generate README
|
||||
|
||||
on:
|
||||
# push:
|
||||
# paths:
|
||||
# - 'core/data/**'
|
||||
# - 'core/components/**'
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 1 * * *' # Every day at midnight UTC
|
||||
- cron: "0 1 * * *"
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: core
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
@@ -24,26 +22,24 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
persist-credentials: true
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: 'pyproject.toml'
|
||||
|
||||
- name: Install UV
|
||||
uses: astral-sh/setup-uv@v7
|
||||
|
||||
- name: Set up Python
|
||||
run: uv python install
|
||||
|
||||
- name: Install project
|
||||
run: uv sync --no-dev
|
||||
|
||||
- name: Run script to generate README
|
||||
run: uv run ./core/source/generation/readme_generator.py
|
||||
run: uv run source/generation/readme_generator.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 source/testing/test.md
|
||||
git add readmes/
|
||||
git add README.md
|
||||
git add ../resources/readmes/
|
||||
git add ../README.md
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "Generate READMEs"
|
||||
git push
|
||||
|
||||
@@ -26,13 +26,13 @@ def format_stars(n):
|
||||
|
||||
# Generates actual list contents in markdown (categories and projects within)
|
||||
def generate_contents(platform="all"):
|
||||
with open("core/data/static/categories.json", "r", encoding="utf-8") as f:
|
||||
with open("data/static/categories.json", "r", encoding="utf-8") as f:
|
||||
cat_data = json.load(f)
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
with open("data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
app_data = json.load(f)
|
||||
with open("core/data/static/tags.json", "r", encoding="utf-8") as f:
|
||||
with open("data/static/tags.json", "r", encoding="utf-8") as f:
|
||||
tags_data = json.load(f)
|
||||
with open("core/data/static/platforms.json", "r", encoding="utf-8") as f:
|
||||
with open("data/static/platforms.json", "r", encoding="utf-8") as f:
|
||||
platforms_data = json.load(f)
|
||||
|
||||
categories = cat_data.get("categories", [])
|
||||
|
||||
@@ -3,7 +3,7 @@ import json
|
||||
|
||||
# Generates mainheader with dynamic project count
|
||||
def generate_mainheader():
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
with open("data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
project_count = len(data.get("applications", []))
|
||||
|
||||
@@ -6,17 +6,17 @@ platforms = ["all", "windows", "macos", "linux", "selfhost"]
|
||||
|
||||
# Platforms mapped to corresponding header files
|
||||
header_files = {
|
||||
"all": "core/components/header.md",
|
||||
"windows": "core/components/windowsheader.md",
|
||||
"macos": "core/components/macosheader.md",
|
||||
"linux": "core/components/linuxheader.md",
|
||||
"selfhost": "core/components/selfhostheader.md",
|
||||
"all": "components/header.md",
|
||||
"windows": "components/windowsheader.md",
|
||||
"macos": "components/macosheader.md",
|
||||
"linux": "components/linuxheader.md",
|
||||
"selfhost": "components/selfhostheader.md",
|
||||
}
|
||||
|
||||
|
||||
def generate_readme_for_platform(platform):
|
||||
content = ""
|
||||
header_file = header_files.get(platform, "core/components/header.md")
|
||||
header_file = header_files.get(platform, "components/header.md")
|
||||
|
||||
# Inject every component of the list from top to bottom
|
||||
if platform == "all":
|
||||
@@ -25,7 +25,7 @@ def generate_readme_for_platform(platform):
|
||||
with open(header_file, "r", encoding="utf-8") as f:
|
||||
content += f.read() + "\n"
|
||||
|
||||
with open("core/components/tags.md", "r", encoding="utf-8") as f:
|
||||
with open("components/tags.md", "r", encoding="utf-8") as f:
|
||||
content += f.read() + "\n"
|
||||
|
||||
toc_md = generate_table_of_contents()
|
||||
@@ -34,7 +34,7 @@ def generate_readme_for_platform(platform):
|
||||
contents_md = generate_contents(platform)
|
||||
content += contents_md + "\n"
|
||||
|
||||
with open("core/components/footer.md", "r", encoding="utf-8") as f:
|
||||
with open("components/footer.md", "r", encoding="utf-8") as f:
|
||||
content += f.read() + "\n"
|
||||
|
||||
# Write output file
|
||||
|
||||
@@ -7,7 +7,7 @@ def slugify(name):
|
||||
|
||||
|
||||
def generate_table_of_contents():
|
||||
with open("core/data/static/categories.json", "r", encoding="utf-8") as f:
|
||||
with open("data/static/categories.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
categories = data.get("categories", [])
|
||||
subcategories = data.get("subcategories", [])
|
||||
|
||||
Reference in New Issue
Block a user