solarboat 0.7.2

A CLI tool for intelligent Terraform operations management with automatic dependency detection
Documentation
name: 'Solarboat CLI Action'
description: 'Run Solarboat CLI commands in your GitHub Actions workflow'
branding:
  icon: 'anchor'
  color: 'blue'

inputs:
  command:
    description: 'Command to run (scan, plan, or apply)'
    required: true
  plan_output_dir:
    description: 'Directory to save Terraform plan files'
    default: 'terraform-plans'
    required: false
  apply_dry_run:
    description: 'Run apply in dry-run mode (enabled by default for safety)'
    default: 'true'
    required: false
  ignore_workspaces:
    description: 'Comma-separated list of workspaces to ignore'
    required: false
    default: ''
  github_token:
    description: 'GitHub token for PR comments'
    required: true

runs:
  using: 'composite'
  steps:
    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable

    - name: Install Terraform
      uses: hashicorp/setup-terraform@v3
      with:
        terraform_version: "1.7.4"

    - name: Install Solarboat CLI
      shell: bash
      run: |
        # Install Solarboat CLI using cargo
        cargo install solarboat
        
        # Verify installation
        solarboat --version || (echo "Installation failed" && exit 1)

    - name: Run Solarboat CLI
      shell: bash
      run: |
        echo "🚀 Running Solarboat CLI"
        
        # Build the ignore workspaces argument if provided
        IGNORE_WORKSPACES_ARG=""
        if [ ! -z "${{ inputs.ignore_workspaces }}" ]; then
          IGNORE_WORKSPACES_ARG="--ignore-workspaces ${{ inputs.ignore_workspaces }}"
        fi
        
        if [[ "${{ inputs.command }}" == "scan" ]]; then
          solarboat scan
        elif [[ "${{ inputs.command }}" == "plan" ]]; then
          solarboat plan --output-dir ${{ inputs.plan_output_dir }} $IGNORE_WORKSPACES_ARG
        elif [[ "${{ inputs.command }}" == "apply" ]]; then
          solarboat apply --dry-run=${{ inputs.apply_dry_run }} $IGNORE_WORKSPACES_ARG
        else
          echo "❌ Invalid command: ${{ inputs.command }}"
          exit 1
        fi

    - name: Upload Terraform Plans
      if: inputs.command == 'plan'
      uses: actions/upload-artifact@v4
      with:
        name: terraform-plans
        path: ${{ inputs.plan_output_dir }}/
        retention-days: 5

    - name: Comment on PR
      if: github.event_name == 'pull_request' && inputs.command == 'plan'
      uses: actions/github-script@v7
      with:
        github-token: ${{ inputs.github_token }}
        script: |
          const artifactUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts`;
          
          const comment = `## 🚀 Solarboat CLI Results

          Solarboat has analyzed your Terraform changes and generated plans.
          
          ### 📋 Summary
          - ✨ Plans have been generated and uploaded as artifacts
          - 🔍 Review the plans before merging
          - âąī¸ Plans will be retained for 5 days
          
          ### 🔗 Links
          - [View Plan Artifacts](${artifactUrl})
          
          ### â„šī¸ Next Steps
          1. Download and review the plan artifacts
          2. Address any issues found in the plans
          3. Merge the PR when ready
          
          > Note: Check the action logs for detailed module processing information.`;
          
          github.rest.issues.createComment({
            owner: context.repo.owner,
            repo: context.repo.repo,
            issue_number: context.issue.number,
            body: comment
          });