name: Copilot Setup Steps

on:
  workflow_dispatch:
  pull_request:
    paths:
      - .github/workflows/copilot-setup-steps.yml

jobs:
  # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
  copilot-setup-steps:
    runs-on: ubuntu-latest

    permissions:
      contents: read

    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@df4b09108a1de9d6f995fe68f302b3f68bd6d2ef # 2026.07.20.1
        with:
          core: true
          cask: true

      - run: brew install-bundler-gems --groups=all

      # install Homebrew formulae we might need
      - uses: Homebrew/actions/cache-homebrew-prefix@df4b09108a1de9d6f995fe68f302b3f68bd6d2ef # 2026.07.20.1
        with:
          install: shellcheck shfmt gh gnu-tar subversion curl
          workflow-key: copilot-setup-steps

      # brew tests doesn't like world writable directories
      - run: sudo chmod -R g-w,o-w /home/linuxbrew/.linuxbrew/Homebrew
