From f8e8c69de58a079b42fa1186c3c941fa4eeb6ec7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:42:39 +0000 Subject: [PATCH] chore: inline draw workflow with Node.js 24 compatible actions Agent-Logs-Url: https://github.com/DarinRowe/zmk-sofle/sessions/90bf3f76-653d-4257-9803-34bf3faa7d92 Co-authored-by: DarinRowe <5706314+DarinRowe@users.noreply.github.com> --- .github/workflows/draw.yml | 76 +++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/.github/workflows/draw.yml b/.github/workflows/draw.yml index 3411ab01a4..b5f52beda8 100644 --- a/.github/workflows/draw.yml +++ b/.github/workflows/draw.yml @@ -9,10 +9,76 @@ on: jobs: draw: - uses: caksoylar/keymap-drawer/.github/workflows/draw-zmk.yml@main + runs-on: ubuntu-latest permissions: contents: write - with: - commit_message: "[Draw] ${{ github.event.head_commit.message }}" - destination: "commit" - fail_on_error: ${{ fromJSON(true) }} + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install keymap-drawer + run: pipx install "keymap-drawer" + + - name: Install west + run: pipx install west + + - name: Fetch west modules + run: | + west init -l config + west config --local manifest.project-filter " -zmk,-zephyr" + west update --fetch-opt=--filter=tree:0 + + - name: Draw keymaps + run: | + shopt -s nullglob extglob + error_occurred=0 + mkdir -p "keymap-drawer" + + config_path="keymap_drawer.config.yaml" + [ -e "$config_path" ] && config_arg=(-c "$config_path") || config_arg=() + echo "INFO: using config args:" "${config_arg[@]}" + + for keymap_file in config/*.keymap; do + keyboard=$(basename -s .keymap "$keymap_file") + echo "INFO: drawing for $keyboard" + + draw_args=() + if [ -f "config/${keyboard}.json" ]; then + echo "INFO: found config/${keyboard}.json" + draw_args+=(-j "config/${keyboard}.json") + else + dts_candidates=({,*/}boards/*/*/${keyboard}-layout{,s}.dtsi) + if [ ${#dts_candidates[@]} -gt 0 ]; then + echo "INFO: found ${dts_candidates[0]}" + draw_args+=(-d "${dts_candidates[0]}") + fi + fi + + tmp_yaml=$(mktemp) + tmp_svg=$(mktemp) + + if keymap "${config_arg[@]}" parse -z "$keymap_file" >"$tmp_yaml"; then + mv "$tmp_yaml" "keymap-drawer/$keyboard.yaml" + else + echo "ERROR: parsing failed for $keyboard!" + error_occurred=1 + continue + fi + + if keymap "${config_arg[@]}" draw "keymap-drawer/$keyboard.yaml" "${draw_args[@]}" >"$tmp_svg"; then + mv "$tmp_svg" "keymap-drawer/$keyboard.svg" + else + echo "ERROR: drawing failed for $keyboard!" + error_occurred=1 + fi + done + + if [ $error_occurred -eq 1 ]; then + exit 1 + fi + + - name: Commit updated images + uses: stefanzweifel/git-auto-commit-action@v7 + with: + file_pattern: "keymap-drawer/*.svg keymap-drawer/*.yaml" + commit_message: "[Draw] ${{ github.event.head_commit.message }}"