From 91225e185dd1aa80440adfac36f47d108723386f Mon Sep 17 00:00:00 2001 From: natxocc Date: Sun, 26 Apr 2026 18:02:09 +0200 Subject: [PATCH] Actualizar .github/workflows/sync-to-github.yml --- .github/workflows/sync-to-github.yml | 41 +++++++++++----------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/.github/workflows/sync-to-github.yml b/.github/workflows/sync-to-github.yml index 92d6799..a636165 100644 --- a/.github/workflows/sync-to-github.yml +++ b/.github/workflows/sync-to-github.yml @@ -2,54 +2,45 @@ name: Sync selected files to GitHub on: push: - branches: [ main, master ] - workflow_dispatch: # permite ejecución manual + branches: [ main ] + workflow_dispatch: jobs: sync: runs-on: ubuntu-latest steps: - - name: Checkout source (Gitea) - uses: actions/checkout@v4 - with: - path: source + # 1️⃣ Clonar origen (Gitea) usando dominio externo + - name: Clone source from Gitea + run: | + git clone https://git.natxocc.com/natxocc/sigpro.git source + cd source + git checkout main # o la rama que necesites + # 2️⃣ Clonar destino (GitHub) igual que antes - name: Clone destination (GitHub) run: | git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/natxocc/sigpro.git dest cd dest - git config user.name "Gitea Sync Bot" + git config user.name "Sync Bot" git config user.email "bot@natxocc.com" + # 3️⃣ Copiar archivos seleccionados - name: Copy selected files run: | - # Lista de archivos (rutas relativas desde la raíz del repositorio) - FILES=" - sigpro.js - sigpro.d.ts - vite/index.js - dist/sigpro.esm.js - dist/sigpro.esm.min.js - dist/sigpro.js - dist/sigpro.min.js - " + FILES="sigpro.js sigpro.d.ts vite/index.js dist/sigpro.esm.js dist/sigpro.esm.min.js dist/sigpro.js dist/sigpro.min.js" for file in $FILES; do if [ -f "source/$file" ]; then mkdir -p "dest/$(dirname $file)" cp "source/$file" "dest/$file" echo "Copied $file" else - echo "Warning: source/$file not found, skipping" + echo "Warning: source/$file not found" fi done - - name: Commit and push changes + # 4️⃣ Commit y push a GitHub + - name: Commit and push run: | cd dest git add . - if git diff --staged --quiet; then - echo "No changes to sync" - else - git commit -m "Sync selected files from Gitea [skip ci]" - git push origin main - fi \ No newline at end of file + git diff --staged --quiet || (git commit -m "Sync selected files from Gitea [skip ci]" && git push origin main) \ No newline at end of file