name: 'Export DSN'
description: 'Export Specctra DSN from a Kicad PCB'
inputs:
  boards:
    description: 'Board names'
    required: true
runs:
  using: 'docker'
  image: 'docker://soundmonster/kicad-automation-scripts:latest'
  entrypoint: '/bin/sh'
  args:
    - '-c'
    # GH actions set $HOME to a weird location and we have to move Kicad settings there first
    - |
      mkdir -p $HOME/.config/kicad ;
      cp /root/.config/kicad/* $HOME/.config/kicad ;
      for board in ${{ inputs.boards }};
      do
        echo Processing $board
        /usr/lib/python2.7/dist-packages/kicad-automation/pcbnew_automation/export_dsn.py $GITHUB_WORKSPACE/output/pcbs/${board}.kicad_pcb $GITHUB_WORKSPACE/output/pcbs/${board}.dsn
      done
