Auto fetch cards for certain projects
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- git, github-actions, python
- Ambito
- build-system
Direzione di ricerca
Start with the proposed scripts/sync_folders.py and JSON configuration, then inspect the repository’s existing GitHub Actions workflow and rendering setup. Confirm the two source folders and destination paths match the project structure, and check whether cards depend on assets outside those folders. Done means CI syncs the configured folders before rendering and the generated destination is ignored by Git.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Suggested setup
Put the fetch in a script so CI and local use are identical:
[
{
"path_to_folder_to_synchronize_from": "https://github.com/InseeFrLab/codif-ape-prez/tree/main/cards",
"path_to_folder_to_synchronize_to": "project/2022_codif_ape/cards"
},
{
"path_to_folder_to_synchronize_from": "https://github.com/InseeFrLab/satellite-images-docs/tree/main/cards",
"path_to_folder_to_synchronize_to": "project/2022_satellites/cards"
}
]
#scripts/sync_folders.py
"""Sync folders from other GitHub repos into this repo, based on a JSON list."""
import json
import re
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
CONFIG = Path(sys.argv[1] if len(sys.argv) > 1 else "scripts/sync_folders.json")
# https://github.com/<owner>/<repo>/tree/<branch>/<folder>
URL_RE = re.compile(
r"^https://github\.com/(?P<owner>[^/]+)/(?P<repo>[^/]+)"
r"/tree/(?P<ref>[^/]+)/(?P<folder>.+?)/?$"
)
def run(*args):
subprocess.run(args, check=True)
def sync(src_url: str, dest: str) -> None:
m = URL_RE.match(src_url)
if not m:
raise ValueError(f"Unsupported URL (expected .../tree/<branch>/<folder>): {src_url}")
repo_url = f"https://github.com/{m['owner']}/{m['repo']}.git"
ref, folder = m["ref"], m["folder"]
with tempfile.TemporaryDirectory() as tmp:
run("git", "clone", "--depth", "1", "--filter=blob:none", "--sparse",
"--branch", ref, repo_url, tmp)
run("git", "-C", tmp, "sparse-checkout", "set", folder)
source = Path(tmp) / folder
if not source.is_dir():
raise FileNotFoundError(f"{folder} not found in {repo_url}@{ref}")
dest_path = Path(dest)
if dest_path.exists():
shutil.rmtree(dest_path)
dest_path.parent.mkdir(parents=True, exist_ok=True)
shutil.copytree(source, dest_path)
print(f"Synced {src_url} -> {dest}")
def main() -> None:
for entry in json.loads(CONFIG.read_text()):
sync(
entry["path_to_folder_to_synchronize_from"],
entry["path_to_folder_to_synchronize_to"],
)
if __name__ == "__main__":
main()
In the workflow, run it before rendering:
- uses: actions/checkout@v4
- name: Sync external folders
run: uv run python scripts/sync_folders.py
- name: Render
run: uv run quarto render
Add project/2022_codif_ape/cards/ to .gitignore so the copied files never get committed. If the repo is public, no token is needed.
If the cards reference images or other assets stored outside cards/ in the upstream repo, copy those folders too (add them to sparse-checkout set), otherwise the listing thumbnails may break.
- Lingua principale
- CSS
- Stelle
- 14
- Fork
- 13
- Merge medio
- 1g 9h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di InseeFrLab/ssphub
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
InseeFrLab/ssphub#196 ·
-
Fusion - Harmonize contributing and readmeForse di nuovo libera @nicotlm l’ha presa 161 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation
InseeFrLab/ssphub#147 · 1 assegnatario ·
-
move image to S3Apertaressources
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
InseeFrLab/ssphub#143 ·
-
github_actions
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
InseeFrLab/ssphub#142 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
InseeFrLab/ssphub#128 ·
Tutte le issue di InseeFrLab/ssphub
Issue simili
-
ci javascript tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jonathanong/no-mistakes#3258 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
developmentseed/async-geotiff#185 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
chore: remove the git-cliff changelog target that would overwrite CHANGELOG.mdForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertachore good first issue priority: low size: XS status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
cubrid-lab/sqlalchemy-cubrid#1293 ·
I maintainer di solito rispondono entro 1 giorno