From 933cb8cc3574cf70a8e902880b93191c4592c2fd Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 5 Apr 2026 06:37:41 +0100 Subject: [PATCH] Update CI workflow to dynamically set keymaps (#26120) --- .github/workflows/ci_build_major_branch.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_build_major_branch.yml b/.github/workflows/ci_build_major_branch.yml index c7bfac919a..5ff6d8b4cc 100644 --- a/.github/workflows/ci_build_major_branch.yml +++ b/.github/workflows/ci_build_major_branch.yml @@ -32,6 +32,7 @@ jobs: container: ghcr.io/qmk/qmk_cli outputs: + keymaps: ${{ steps.generate_slice_length.outputs.keymaps }} slice_length: ${{ steps.generate_slice_length.outputs.slice_length }} steps: @@ -47,12 +48,20 @@ jobs: - name: Determine concurrency id: generate_slice_length + shell: 'bash {0}' run: | - target_count=$( { - qmk find -km default 2>/dev/null - qmk find -km xap 2>/dev/null - } | sort | uniq | wc -l) + targets=() + target_count=0 + for target in "default" "xap"; do + count=$(qmk find -km $target 2>/dev/null | wc -l) + if [ $count -gt 0 ]; then + target_count=$(($target_count + $count)) + targets+=($target) + fi + done + keymaps=$(jq -c -n '$ARGS.positional' --args "${targets[@]}") slice_length=$((target_count / ($CONCURRENT_JOBS - 1))) # Err on the side of caution + echo "keymaps=$keymaps" >> $GITHUB_OUTPUT echo "slice_length=$slice_length" >> $GITHUB_OUTPUT build_targets: @@ -61,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - keymap: [default, xap] + keymap: ${{ fromJson(needs.determine_concurrency.outputs.keymaps) }} uses: ./.github/workflows/ci_build_major_branch_keymap.yml with: branch: ${{ inputs.branch || github.ref_name }}