From febcf10bc1d7d2d6598ef163b52ef12f33288768 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 1 Apr 2026 08:01:20 -0400 Subject: [PATCH 1/2] ci(compile): [perf] replace full clone with shallow checkout and remove broken git cache Signed-off-by: Josh --- .github/workflows/command-compile.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/command-compile.yml b/.github/workflows/command-compile.yml index f245332d60f8d..3e9cd8c12bc27 100644 --- a/.github/workflows/command-compile.yml +++ b/.github/workflows/command-compile.yml @@ -96,21 +96,27 @@ jobs: needs: init steps: - - name: Restore cached git repository - uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2 - with: - path: .git - key: git-repo - - - name: Checkout ${{ needs.init.outputs.head_ref }} + - name: Checkout (shallow) ${{ needs.init.outputs.head_ref }} uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: # Needed to allow force push later persist-credentials: true token: ${{ secrets.COMMAND_BOT_PAT }} - fetch-depth: 0 + fetch-depth: 1 ref: ${{ needs.init.outputs.head_ref }} + - name: Fetch parent commit for amend + if: ${{ contains(needs.init.outputs.arg1, 'amend') }} + run: git fetch --deepen=1 + + - name: Fetch full history for rebase + if: ${{ contains(needs.init.outputs.arg1, 'rebase') }} + run: | + git fetch --unshallow + git fetch origin "$BASE_REF" + env: + BASE_REF: ${{ needs.init.outputs.base_ref }} + - name: Setup git run: | git config --local user.email 'nextcloud-command@users.noreply.github.com' From c6d1fc18596db40ba0836ae5afbd6dc06fda990e Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 1 Apr 2026 09:20:04 -0400 Subject: [PATCH 2/2] ci(compile): simplify rebase Signed-off-by: Josh --- .github/workflows/command-compile.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/command-compile.yml b/.github/workflows/command-compile.yml index 3e9cd8c12bc27..ebc48010f913d 100644 --- a/.github/workflows/command-compile.yml +++ b/.github/workflows/command-compile.yml @@ -113,7 +113,7 @@ jobs: if: ${{ contains(needs.init.outputs.arg1, 'rebase') }} run: | git fetch --unshallow - git fetch origin "$BASE_REF" + git fetch origin "${BASE_REF}:${BASE_REF}" env: BASE_REF: ${{ needs.init.outputs.base_ref }} @@ -140,11 +140,11 @@ jobs: - name: Rebase to ${{ needs.init.outputs.base_ref }} if: ${{ contains(needs.init.outputs.arg1, 'rebase') }} + env: + BASE_REF: ${{ needs.init.outputs.base_ref }} run: | - git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}' - # Start the rebase - git rebase 'origin/${{ needs.init.outputs.base_ref }}' || { + git rebase "$BASE_REF" || { # Handle rebase conflicts in a loop while [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; do echo "Handling rebase conflict..." @@ -152,11 +152,11 @@ jobs: # Remove and checkout /dist and /js folders from the base branch if [ -d "dist" ]; then rm -rf dist - git checkout origin/${{ needs.init.outputs.base_ref }} -- dist/ 2>/dev/null || echo "No dist folder in base branch" + git checkout "$BASE_REF" -- dist/ 2>/dev/null || echo "No dist folder in base branch" fi if [ -d "js" ]; then rm -rf js - git checkout origin/${{ needs.init.outputs.base_ref }} -- js/ 2>/dev/null || echo "No js folder in base branch" + git checkout "$BASE_REF" -- js/ 2>/dev/null || echo "No js folder in base branch" fi # Stage all changes