main action.yml
Eric Bower  ·  2026-08-15
  1name: "Pici CI"
  2description: "Run parallel CI workflows with pico.sh, zmx, and interactive pipe.pico.sh remote debugging"
  3author: "pico.sh"
  4branding:
  5  icon: "terminal"
  6  color: "blue"
  7
  8inputs:
  9  pico_ssh_key:
 10    description: "SSH private key registered with pico.sh for authenticated pipe.pico.sh debug relay access"
 11    required: false
 12    default: ""
 13  pico_ssh_cert:
 14    description: "SSH public certificate key for authenticating with pico.sh debug relay"
 15    required: false
 16    default: ""
 17  debug_on_fail:
 18    description: "Automatically open an interactive pipe.pico.sh debug bridge if a job fails (true, false, auto)"
 19    required: false
 20    default: "auto"
 21  summary:
 22    description: "Write Markdown summary table to GITHUB_STEP_SUMMARY"
 23    required: false
 24    default: "true"
 25  working_directory:
 26    description: "Directory containing pico.sh"
 27    required: false
 28    default: "."
 29  zmx_version:
 30    description: "Pinned zmx release version to install"
 31    required: false
 32    default: "v0.1.0"
 33  pici_version:
 34    description: "Pinned pici release version to install"
 35    required: false
 36    default: "latest"
 37
 38runs:
 39  using: "composite"
 40  steps:
 41    - name: Set up SSH key and certificate for pico.sh debug relay
 42      if: inputs.pico_ssh_key != ''
 43      shell: bash
 44      run: |
 45        mkdir -p ~/.ssh
 46        chmod 700 ~/.ssh
 47        echo "${{ inputs.pico_ssh_key }}" > ~/.ssh/id_pici_debug
 48        chmod 600 ~/.ssh/id_pici_debug
 49        if [ -n "${{ inputs.pico_ssh_cert }}" ]; then
 50          echo "${{ inputs.pico_ssh_cert }}" > ~/.ssh/id_pici_debug-cert.pub
 51          chmod 644 ~/.ssh/id_pici_debug-cert.pub
 52        fi        
 53
 54    - name: Install zmx
 55      shell: bash
 56      run: |
 57        if ! command -v zmx >/dev/null 2>&1; then
 58          echo "==> Installing zmx..."
 59          curl -fsSL https://github.com/picosh/zmx/releases/latest/download/zmx-linux-amd64 -o /usr/local/bin/zmx || \
 60          curl -fsSL https://pkg.pico.sh/zmx -o /usr/local/bin/zmx
 61          chmod +x /usr/local/bin/zmx
 62        fi        
 63
 64    - name: Install pici
 65      shell: bash
 66      run: |
 67        if ! command -v pici >/dev/null 2>&1; then
 68          echo "==> Installing pici..."
 69          curl -fsSL https://pkg.pico.sh/pici -o /usr/local/bin/pici || true
 70          if [ ! -f /usr/local/bin/pici ]; then
 71            go install github.com/picosh/pici@latest
 72          else
 73            chmod +x /usr/local/bin/pici
 74          fi
 75        fi        
 76
 77    - name: Run Pici CI
 78      shell: bash
 79      working-directory: ${{ inputs.working_directory }}
 80      run: |
 81        FLAGS="--in-place"
 82
 83        # Determine debug-on-fail flag
 84        if [ "${{ inputs.debug_on_fail }}" = "true" ] || { [ "${{ inputs.debug_on_fail }}" = "auto" ] && [ "${RUNNER_DEBUG:-0}" = "1" ]; }; then
 85          FLAGS="$FLAGS --debug-on-fail"
 86        fi
 87
 88        # Pass summary file flag if enabled
 89        if [ "${{ inputs.summary }}" = "true" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
 90          FLAGS="$FLAGS --summary-file $GITHUB_STEP_SUMMARY"
 91        fi
 92
 93        # Pass SSH key & certificate if configured
 94        if [ -f "$HOME/.ssh/id_pici_debug" ]; then
 95          FLAGS="$FLAGS -pk $HOME/.ssh/id_pici_debug"
 96        fi
 97        if [ -f "$HOME/.ssh/id_pici_debug-cert.pub" ]; then
 98          FLAGS="$FLAGS -ck $HOME/.ssh/id_pici_debug-cert.pub"
 99        fi
100
101        echo "==> Executing: pici run $FLAGS"
102        pici run $FLAGS \
103          -e PICI_JOB="${GITHUB_RUN_ID:-local}" \
104          -e PICI_EVENT="git.${GITHUB_EVENT_NAME:-push}" \
105          -e PICI_BRANCH="${GITHUB_REF_NAME:-main}" \
106          -e PICI_COMMIT="${GITHUB_SHA:-dev}" \
107          -e PICI_REPO="${GITHUB_REPOSITORY:-local}"