From 90a9904e9f6e27a559e138c03e0bc65a08e11cc5 Mon Sep 17 00:00:00 2001 From: Vlad Mocanu Date: Fri, 27 Feb 2026 16:52:39 +0200 Subject: [PATCH] feat: mirror to Codeberg via SSH deploy key Push clean copy (without .forgejo/ and prds/) to Codeberg on each push to main. Uses SSH deploy key for authentication. Also bumps kcl-ci to v1.40.0. Co-Authored-By: Claude Opus 4.6 --- .forgejo/kcl-ci/kcl.mod | 2 +- .forgejo/kcl-ci/kcl.mod.lock | 2 +- .forgejo/kcl-ci/main.k | 4 ++- .forgejo/workflows/ci.yml | 2 +- .forgejo/workflows/claude.yml | 2 +- .forgejo/workflows/kcl-ci-build.yml | 4 +-- .forgejo/workflows/mirror-branch.yml | 44 +++++++++++++++------------- .forgejo/workflows/test-action.yml | 2 +- .forgejo/workflows/upstream-sync.yml | 2 +- 9 files changed, 34 insertions(+), 30 deletions(-) diff --git a/.forgejo/kcl-ci/kcl.mod b/.forgejo/kcl-ci/kcl.mod index 8b7b669..53f3430 100644 --- a/.forgejo/kcl-ci/kcl.mod +++ b/.forgejo/kcl-ci/kcl.mod @@ -4,4 +4,4 @@ edition = "v0.12.3" version = "0.0.1" [dependencies] -kcl-ci = { git = "https://git.wxs.ro/actions/kcl-ci", tag = "v1.38.0" } +kcl-ci = { git = "https://git.wxs.ro/actions/kcl-ci", tag = "v1.40.0" } diff --git a/.forgejo/kcl-ci/kcl.mod.lock b/.forgejo/kcl-ci/kcl.mod.lock index 325a382..1bd06fb 100644 --- a/.forgejo/kcl-ci/kcl.mod.lock +++ b/.forgejo/kcl-ci/kcl.mod.lock @@ -4,4 +4,4 @@ full_name = "kcl-ci_0.0.1" version = "0.0.1" url = "https://git.wxs.ro/actions/kcl-ci" - git_tag = "v1.38.0" + git_tag = "v1.40.0" diff --git a/.forgejo/kcl-ci/main.k b/.forgejo/kcl-ci/main.k index ceb48f1..1615f51 100644 --- a/.forgejo/kcl-ci/main.k +++ b/.forgejo/kcl-ci/main.k @@ -669,7 +669,9 @@ fi""" # Excludes internal CI config and development history # ============================================================================= _mirror_config = mirror_mod.MirrorBranchConfig { - target_branch = "codeberg" + remote_url = "git@codeberg.org:vtmocanu/claude-code-action.git" + ssh_key_secret = "CODEBERG_MIRROR_SSH_KEY" + ssh_host = "codeberg.org" exclude_paths = [".forgejo", "prds"] paths_ignore = [".forgejo/kcl-ci/**", "prds/**"] } diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 9624d0a..4a676a7 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -1,4 +1,4 @@ -# Generated by KCL v1.38.0 - DO NOT EDIT +# Generated by KCL v1.40.0 - DO NOT EDIT # Source: .forgejo/kcl-ci/main.k # kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci # kcl-ci remote: https://git.wxs.ro/actions/kcl-ci diff --git a/.forgejo/workflows/claude.yml b/.forgejo/workflows/claude.yml index e2812ce..074a646 100644 --- a/.forgejo/workflows/claude.yml +++ b/.forgejo/workflows/claude.yml @@ -1,4 +1,4 @@ -# Generated by KCL v1.38.0 - DO NOT EDIT +# Generated by KCL v1.40.0 - DO NOT EDIT # Source: .forgejo/kcl-ci/main.k # kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci # kcl-ci remote: https://git.wxs.ro/actions/kcl-ci diff --git a/.forgejo/workflows/kcl-ci-build.yml b/.forgejo/workflows/kcl-ci-build.yml index db090d2..9d4abdd 100644 --- a/.forgejo/workflows/kcl-ci-build.yml +++ b/.forgejo/workflows/kcl-ci-build.yml @@ -1,4 +1,4 @@ -# Generated by KCL v1.38.0 - DO NOT EDIT +# Generated by KCL v1.40.0 - DO NOT EDIT # Source: .forgejo/kcl-ci/main.k # kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci # kcl-ci remote: https://git.wxs.ro/actions/kcl-ci @@ -21,7 +21,7 @@ jobs: runs-on: grunt steps: - name: Build KCL workflows - uses: https://${{ secrets.READ_REPO_TOKEN }}@git.wxs.ro/actions/kcl-ci@v1.38.0 + uses: https://${{ secrets.READ_REPO_TOKEN }}@git.wxs.ro/actions/kcl-ci@v1.40.0 with: read-repo-token: ${{ secrets.READ_REPO_TOKEN }} working-dir: '.forgejo/kcl-ci' diff --git a/.forgejo/workflows/mirror-branch.yml b/.forgejo/workflows/mirror-branch.yml index 8a5a54b..d0f9c87 100644 --- a/.forgejo/workflows/mirror-branch.yml +++ b/.forgejo/workflows/mirror-branch.yml @@ -1,9 +1,9 @@ -# Generated by KCL v1.38.0 - DO NOT EDIT +# Generated by KCL v1.40.0 - DO NOT EDIT # Source: .forgejo/kcl-ci/main.k # kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci # kcl-ci remote: https://git.wxs.ro/actions/kcl-ci -name: Mirror Branch +name: Mirror to Remote 'on': push: branches: @@ -18,8 +18,8 @@ concurrency: env: READ_REPO_TOKEN: ${{ secrets.READ_REPO_TOKEN }} jobs: - update-mirror: - name: Update Mirror Branch + push-mirror: + name: Push to Mirror runs-on: grunt steps: - name: Checkout code @@ -27,28 +27,30 @@ jobs: with: fetch-depth: '0' token: ${{ github.token }} - - name: Configure git credentials + - name: Configure SSH for mirror run: |- - git config --local user.name "forgejo-actions[bot]" - git config --local user.email "forgejo-actions[bot]@git.wxs.ro" - # Clear checkout action's extraheader (read-only token) - git config --local --unset-all http.https://git.wxs.ro/.extraheader || true - # Set remote URL with write token - git remote set-url origin "https://token:${GITHUB_TOKEN}@git.wxs.ro/${{ github.repository }}.git" + mkdir -p ~/.ssh + echo "${MIRROR_SSH_KEY}" > ~/.ssh/mirror_key + chmod 600 ~/.ssh/mirror_key + ssh-keyscan codeberg.org >> ~/.ssh/known_hosts 2>/dev/null + export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o StrictHostKeyChecking=no" env: - GITHUB_TOKEN: ${{ github.token }} - - name: Create mirror branch + MIRROR_SSH_KEY: ${{ secrets.CODEBERG_MIRROR_SSH_KEY }} + - name: Prepare and push to mirror run: |- - # Create or reset the mirror branch from current HEAD - git checkout -B codeberg - # Remove excluded paths rm -rf .forgejo rm -rf prds - # Commit and force-push + # Commit cleaned tree (detached from source history) + git checkout -B mirror-staging git add -A - git commit -m "mirror: $(git log -1 --format='%h %s' main) [skip ci]" || echo "No changes to commit" - git push origin codeberg --force - env: - GITHUB_TOKEN: ${{ github.token }} + git diff --cached --quiet || git commit -m "mirror: $(git log -1 --format='%h %s' main)" + + # Push to remote via SSH + export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o StrictHostKeyChecking=no" + git remote add mirror git@codeberg.org:vtmocanu/claude-code-action.git + git push mirror mirror-staging:main --force + + # Cleanup + rm -f ~/.ssh/mirror_key diff --git a/.forgejo/workflows/test-action.yml b/.forgejo/workflows/test-action.yml index c67c970..2ba60f7 100644 --- a/.forgejo/workflows/test-action.yml +++ b/.forgejo/workflows/test-action.yml @@ -1,4 +1,4 @@ -# Generated by KCL v1.38.0 - DO NOT EDIT +# Generated by KCL v1.40.0 - DO NOT EDIT # Source: .forgejo/kcl-ci/main.k # kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci # kcl-ci remote: https://git.wxs.ro/actions/kcl-ci diff --git a/.forgejo/workflows/upstream-sync.yml b/.forgejo/workflows/upstream-sync.yml index d4754c8..bba4055 100644 --- a/.forgejo/workflows/upstream-sync.yml +++ b/.forgejo/workflows/upstream-sync.yml @@ -1,4 +1,4 @@ -# Generated by KCL v1.38.0 - DO NOT EDIT +# Generated by KCL v1.40.0 - DO NOT EDIT # Source: .forgejo/kcl-ci/main.k # kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci # kcl-ci remote: https://git.wxs.ro/actions/kcl-ci