name: Setup Bazel environment
description: Setup a Bazel environment, including Bazelisk and fine-grained caching

inputs:
  bazelisk-cache:
    description: Caches Bazelisk downloads based on .bazelversion
    required: false
    default: "false"
  bazelisk-version:
    description: The Bazelisk version to download and use if necessary
    default: ""
  bazelrc:
    description: Extra contents to write to user .bazelrc
    required: false
    default: ""
  cache-version:
    description: Version of all caches
    required: false
    default: "1"
  disk-cache:
    description: Cache actions outputs based on BUILD
    required: false
    default: "false"
  external-cache:
    description: Cache external 10MB+ repositories based on MODULE.bazel/WORKSPACE
    required: false
    default: ""
  google-credentials:
    description: Google Cloud account key for remote cache
    required: false
    default: ""
  remote-cache:
    description: Use built-in remote cache server
    required: false
    default: "false"
  repository-cache:
    description: Cache repositories based on MODULE.bazel/WORKSPACE
    required: false
    default: "false"
  token:
    description: GitHub token to query Bazelisk releases
    required: false
    default: ${{ github.token }}

runs:
  using: node20
  main: dist/main/index.js
  post: dist/post/index.js
