From 6338746d624461321e9b429aa5070375da1efff1 Mon Sep 17 00:00:00 2001 From: Life Date: Wed, 27 May 2026 18:47:34 +0200 Subject: [PATCH 1/4] Add GitHub Actions workflow for safe sync of fork --- .github/workflows/sync-fork.yml | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/sync-fork.yml diff --git a/.github/workflows/sync-fork.yml b/.github/workflows/sync-fork.yml new file mode 100644 index 0000000..10fd220 --- /dev/null +++ b/.github/workflows/sync-fork.yml @@ -0,0 +1,48 @@ +name: Safe Sync - Nitro-V3 + +on: + schedule: + - cron: '0 0 * * *' # Sincronizza ogni giorno a mezzanotte UTC + workflow_dispatch: # Permette l'avvio manuale dalla scheda Actions + +jobs: + sync-safe: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout Fork + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Scarica tutta la cronologia per poter fare il merge correttamente + + - name: Configure Git Credentials + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Fetch and Merge Upstream + run: | + # Aggiunge il repository originale + git remote add upstream https://github.com/duckietm/Nitro-V3.git + git fetch upstream + + # Cicla su tutti i branch presenti nell'upstream originale + for branch in $(git branch -r | grep 'upstream/' | grep -v 'HEAD'); do + local_branch=${branch#upstream/} + echo "Elaborazione branch: $local_branch" + + # Si sposta sul branch locale (se non esiste lo crea basandosi sull'upstream) + git checkout $local_branch || git checkout -b $local_branch upstream/$local_branch + + # Esegue il merge delle novità dell'upstream nel tuo branch locale + # --no-edit accetta il messaggio di commit automatico di git + if git merge upstream/$local_branch --no-edit; then + echo "Merge completato con successo per $local_branch. Invio gli aggiornamenti..." + git push origin $local_branch + else + echo "Rilevato conflitto di merge su $local_branch! Il tuo lavoro è al sicuro. Salto il push per questo branch." + git merge --abort + fi + done From bbe130e1d4278e73ec9280f31759d279fd27309b Mon Sep 17 00:00:00 2001 From: Life Date: Thu, 28 May 2026 17:44:56 +0200 Subject: [PATCH 2/4] Improve renderer pairing logic in CI configuration Refactor renderer repository and reference resolution logic in CI workflow. --- .github/workflows/ci.yml | 76 +++++++++++++++------------------------- 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3a8cd0..fd8069b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,61 +72,41 @@ jobs: VAR_REPO: ${{ vars.RENDERER_REPO }} VAR_REF: ${{ vars.RENDERER_REF }} run: | - REPO="${{ github.event.inputs.renderer_repo }}" - REF="${{ github.event.inputs.renderer_ref }}" + # Branch-aware auto pairing — the default when neither a + # dispatch input nor a repo variable is supplied. + # + # Everything (including the custom features — rare values, + # fortune wheel, soundboard) now lives on duckietm's own + # `main` / `Dev` branches, so the renderer always pairs + # against UPSTREAM_RENDERER_REPO: `main` when the client build + # context is `main`, otherwise `Dev`. For PRs the context is + # the base ref. + case "${GITHUB_EVENT_NAME}" in + pull_request) + CTX="${GITHUB_BASE_REF}" + ;; + *) + CTX="${GITHUB_REF_NAME}" + ;; + esac - if [ -z "$REPO" ] || [ -z "$REF" ]; then - # For PRs we usually pair against the base ref, but the HK - # PR specifically needs to pair against its OWN head ref — - # the renderer companion PR is named identically - # (`feat/housekeeping-packets`) and lives on the same fork. - case "${GITHUB_EVENT_NAME}" in - pull_request) - if [ "${GITHUB_HEAD_REF}" = "feat/housekeeping-panel" ]; then - CTX="${GITHUB_HEAD_REF}" - else - CTX="${GITHUB_BASE_REF}" - fi - ;; - *) - CTX="${GITHUB_REF_NAME}" - ;; - esac + AUTO_REPO="${UPSTREAM_RENDERER_REPO}" + case "$CTX" in + main) AUTO_REF="main" ;; + *) AUTO_REF="Dev" ;; + esac - case "$CTX" in - main) - AUTO_REPO="duckietm/Nitro_Render_V3" - AUTO_REF="main" - ;; - Dev) - # The client `Dev` branch carries the custom features - # (rare values, fortune wheel, soundboard); they live on - # the matching renderer fork branch, not upstream. - AUTO_REPO="medievalshell/Nitro_Render_V3" - AUTO_REF="dev" - ;; - feat/housekeeping-panel) - AUTO_REPO="simoleo89/Nitro_Render_V3" - AUTO_REF="feat/housekeeping-packets" - ;; - *) - AUTO_REPO="duckietm/Nitro_Render_V3" - AUTO_REF="Dev" - ;; - esac - - [ -z "$REPO" ] && REPO="$AUTO_REPO" - [ -z "$REF" ] && REF="$AUTO_REF" - fi - - # Precedence: dispatch input → repo variable → upstream default. + # Precedence (most specific wins): dispatch input → repo + # variable → branch-aware auto default. The auto default is + # the final fallback so a Dev/feat build never silently pairs + # against a renderer that's missing its companion exports. REPO="$IN_REPO" [ -z "$REPO" ] && REPO="$VAR_REPO" - [ -z "$REPO" ] && REPO="$UPSTREAM_RENDERER_REPO" + [ -z "$REPO" ] && REPO="$AUTO_REPO" REF="$IN_REF" [ -z "$REF" ] && REF="$VAR_REF" - [ -z "$REF" ] && REF="$DEFAULT_REF" + [ -z "$REF" ] && REF="$AUTO_REF" echo "repo=$REPO" >> "$GITHUB_OUTPUT" echo "ref=$REF" >> "$GITHUB_OUTPUT" From 9658e1bd40382fdc18057b205dbd17e9ec2cfceb Mon Sep 17 00:00:00 2001 From: Life Date: Thu, 28 May 2026 17:49:40 +0200 Subject: [PATCH 3/4] Enhance sync-fork.yml with better error handling Updated the sync-fork workflow to improve error handling and branch management. --- .github/workflows/sync-fork.yml | 57 ++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/.github/workflows/sync-fork.yml b/.github/workflows/sync-fork.yml index 10fd220..83d1ea1 100644 --- a/.github/workflows/sync-fork.yml +++ b/.github/workflows/sync-fork.yml @@ -2,8 +2,19 @@ name: Safe Sync - Nitro-V3 on: schedule: - - cron: '0 0 * * *' # Sincronizza ogni giorno a mezzanotte UTC - workflow_dispatch: # Permette l'avvio manuale dalla scheda Actions + # GitHub non offre trigger cross-repo: non possiamo "ascoltare" i push + # sull'upstream senza esserne collaboratori. Per avvicinarci a un + # "automatico quando cambia" facciamo polling frequente: ogni run fa + # fetch dell'upstream e lavora SOLO sui branch effettivamente avanzati + # (guard "skip se invariato" sotto). Alza/abbassa la frequenza qui. + # NB: i cron possono partire con qualche minuto di ritardo e GitHub li + # disabilita dopo 60 giorni di inattività del repo. + - cron: '*/30 * * * *' # ogni 30 minuti + workflow_dispatch: # avvio manuale dalla scheda Actions + +concurrency: + group: safe-sync + cancel-in-progress: false jobs: sync-safe: @@ -15,7 +26,7 @@ jobs: - name: Checkout Fork uses: actions/checkout@v4 with: - fetch-depth: 0 # Scarica tutta la cronologia per poter fare il merge correttamente + fetch-depth: 0 - name: Configure Git Credentials run: | @@ -24,25 +35,33 @@ jobs: - name: Fetch and Merge Upstream run: | - # Aggiunge il repository originale - git remote add upstream https://github.com/duckietm/Nitro-V3.git - git fetch upstream - - # Cicla su tutti i branch presenti nell'upstream originale + set -euo pipefail + + git remote add upstream https://github.com/duckietm/Nitro-V3.git 2>/dev/null || \ + git remote set-url upstream https://github.com/duckietm/Nitro-V3.git + git fetch upstream --prune + for branch in $(git branch -r | grep 'upstream/' | grep -v 'HEAD'); do local_branch=${branch#upstream/} - echo "Elaborazione branch: $local_branch" - - # Si sposta sul branch locale (se non esiste lo crea basandosi sull'upstream) - git checkout $local_branch || git checkout -b $local_branch upstream/$local_branch - - # Esegue il merge delle novità dell'upstream nel tuo branch locale - # --no-edit accetta il messaggio di commit automatico di git - if git merge upstream/$local_branch --no-edit; then - echo "Merge completato con successo per $local_branch. Invio gli aggiornamenti..." - git push origin $local_branch + echo "::group::$local_branch" + + git checkout "$local_branch" 2>/dev/null || \ + git checkout -b "$local_branch" "upstream/$local_branch" + + upstream_sha=$(git rev-parse "upstream/$local_branch") + if git merge-base --is-ancestor "$upstream_sha" HEAD; then + echo "Nessun cambiamento per $local_branch, salto." + echo "::endgroup::" + continue + fi + + echo "Novità rilevate su $local_branch, provo il merge..." + if git merge "upstream/$local_branch" --no-edit; then + echo "Merge ok per $local_branch. Invio gli aggiornamenti..." + git push origin "$local_branch" else - echo "Rilevato conflitto di merge su $local_branch! Il tuo lavoro è al sicuro. Salto il push per questo branch." + echo "Conflitto di merge su $local_branch! Il tuo lavoro è al sicuro: salto il push e annullo il merge." git merge --abort fi + echo "::endgroup::" done From f25b103101ad2478153ecd589d176da864393576 Mon Sep 17 00:00:00 2001 From: Life Date: Sun, 31 May 2026 11:26:11 +0200 Subject: [PATCH 4/4] Always render RadioView in MainView component --- src/components/MainView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MainView.tsx b/src/components/MainView.tsx index e155f05..b68f3be 100644 --- a/src/components/MainView.tsx +++ b/src/components/MainView.tsx @@ -184,7 +184,7 @@ export const MainView: FC<{}> = props => - { GetConfigurationValue('radio_ui', true) && } + } );